Skip to content

Commit 90a46aa

Browse files
author
test
committed
dockerise ci test for consistency
1 parent 7f29e5a commit 90a46aa

File tree

7 files changed

+41
-8
lines changed

7 files changed

+41
-8
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
etc/
33
lib/
44
.github/
5-
tests/
65

76
*.md
87
gitconvex-k8s.yml

.github/workflows/go-collab.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444
git config --global user.name "${{ secrets.ACTION_USER_NAME }}" && git config --global user.email "${{ secrets.ACTION_USER_EMAIL }}"
4545
sudo mkdir -p /usr/local/gitconvex
4646
sudo chown $(whoami) /usr/local/gitconvex/
47-
go generate
48-
make test-ci
47+
make dockerise-test
4948
5049
gitconvex-build:
5150
needs:

.github/workflows/go.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444
git config --global user.name "${{ secrets.ACTION_USER_NAME }}" && git config --global user.email "${{ secrets.ACTION_USER_EMAIL }}"
4545
sudo mkdir -p /usr/local/gitconvex
4646
sudo chown $(whoami) /usr/local/gitconvex/
47-
go generate
48-
make test-ci
47+
make dockerise-test
4948
5049
gitconvex-build:
5150
needs:

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ build: clean build-ui bundle build-server
2828
@echo "📬 Use ./dist/gitconvex to start Gitconvex on port 9001"
2929
@echo "📬 Try ./dist/gitconvex --port PORT_NUMBER to run gitconvex on the desired port"
3030

31+
git-testuser-setup:
32+
git config user.name test
33+
git config user.email [email protected]
34+
3135
test:
3236
export GITCONVEX_TEST_REPO="$(PWD)/gitconvex-test" && \
3337
export GITCONVEX_DEFAULT_PATH="$(PWD)/gitconvex-test" && \
@@ -46,12 +50,16 @@ test-pretty:
4650
gotestsum ./... -count=1 -cover -coverprofile=coverage.out && \
4751
rm -rf $$GITCONVEX_TEST_REPO
4852

49-
test-ci:
53+
test-ci: git-testuser-setup
54+
go generate && \
5055
go clean --cache && \
51-
./build_scripts/clone_test_repo.sh && \
56+
sh ./build_scripts/clone_test_repo.sh && \
5257
go test ./... -count=1 -cover -coverprofile=coverage.out && \
5358
rm -rf $$GITCONVEX_TEST_REPO
5459

60+
dockerise-test:
61+
docker-compose -f docker-compose.test.yaml up
62+
5563
show-coverage:
5664
go tool cover -html=coverage.out
5765

Test.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.16.0-alpine
2+
3+
WORKDIR /home/gitconvex
4+
5+
COPY . .
6+
7+
# Install required packages
8+
RUN apk update && \
9+
apk add --update libgit2-dev libssh2-dev gcc make musl-dev git
10+
11+

docker-compose.test.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: "3.3"
2+
3+
networks:
4+
gitconvex-test-network:
5+
6+
services:
7+
gitconvex-test:
8+
build:
9+
context: .
10+
dockerfile: Test.Dockerfile
11+
environment:
12+
- GITCONVEX_TEST_REPO=/home/gitconvex/gitconvex-test
13+
- GITCONVEX_DEFAULT_PATH=/home/gitconvex/gitconvex-test
14+
networks:
15+
- gitconvex-test-network
16+
volumes:
17+
- ./:/home/gitconvex
18+
command: [ "make","test-ci" ]

git/branch/git_branch_compare_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func (suite *BranchCompareTestSuite) SetupSuite() {
3333
}
3434
suite.repo = r
3535
suite.testFile = os.Getenv("GITCONVEX_TEST_REPO") + string(filepath.Separator) + "compare_test.txt"
36-
suite.baseBranch = "master"
3736
suite.compareBranch = "new_compare"
3837
addErr := NewAddBranch(r, suite.compareBranch, false, nil).AddBranch()
3938
if addErr != nil {

0 commit comments

Comments
 (0)