Skip to content

Commit

Permalink
chore(ci): test Dockerfile in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Jul 3, 2024
1 parent 4273dd9 commit 070604c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,21 @@ jobs:
path: ~/.pact/plugins/**/plugin.log
if: ${{ always() }}

test-containers:
runs-on: ubuntu-latest
name: ${{ matrix.go-version }}-test-container
strategy:
fail-fast: false
matrix:
go-version: ["1.20", "1.21", "1.22"]
steps:
- uses: actions/checkout@v4

- name: Test dockerfile
run: make docker_test_all

finish:
needs: [test]
needs: [test,test-containers]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
Expand Down
25 changes: 24 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PLUGIN_PACT_PROTOBUF_VERSION=0.3.15
PLUGIN_PACT_CSV_VERSION=0.0.6
PLUGIN_PACT_MATT_VERSION=0.1.1
PLUGIN_PACT_AVRO_VERSION=0.0.5

GO_VERSION?=1.22
ci:: docker deps clean bin test pact

# Run the ci target from a developer machine with the environment variables
Expand All @@ -31,6 +31,29 @@ docker:
@echo "--- 🛠 Starting docker"
docker-compose up -d

docker_build:
docker build -f Dockerfile --build-arg GO_VERSION=${GO_VERSION} -t pactfoundation/pact-go-test .


docker_test: docker_build
docker run \
-e LOG_LEVEL=INFO \
--rm \
pactfoundation/pact-go-test \
/bin/sh -c "make test"
docker_pact: docker_build
docker run \
-e LOG_LEVEL=INFO \
--rm \
pactfoundation/pact-go-test \
/bin/sh -c "make pact_local"
docker_test_all: docker_build
docker run \
-e LOG_LEVEL=INFO \
--rm \
pactfoundation/pact-go-test \
/bin/sh -c "make test && make pact_local"

bin:
go build -o build/pact-go

Expand Down

0 comments on commit 070604c

Please sign in to comment.