Skip to content

Commit

Permalink
ci: macos-12 / 14
Browse files Browse the repository at this point in the history
- use colima for docker
  • Loading branch information
YOU54F committed May 2, 2024
1 parent 9d36011 commit 844ed97
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 30 deletions.
53 changes: 29 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ on: [push, pull_request, workflow_dispatch]
name: Test

env:
PACT_BROKER_BASE_URL: https://testdemo.pactflow.io
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
REACT_APP_API_BASE_URL: http://localhost:8080
# PACT_BROKER_BASE_URL: https://testdemo.pactflow.io
# PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
# REACT_APP_API_BASE_URL: http://localhost:8080
APP_SHA: ${{ github.sha }}
APP_REF: ${{ github.ref }}
LD_LIBRARY_PATH: /tmp
PACT_GO_LIB_DOWNLOAD_PATH: /tmp
LOG_LEVEL: debug
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOG_LEVEL: info
# COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test:
Expand All @@ -23,7 +23,7 @@ jobs:
1.20.x,
1.21.x
]
os: [ubuntu-latest]
os: [ubuntu-latest, macos-12, macos-14]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
Expand All @@ -36,24 +36,29 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: install Docker on Mac
if: runner.os == 'macOS'
run: |
brew install docker
colima start --runtime docker
- name: Test
run: APP_BRANCH=${APP_REF:11} DOCKER_GATEWAY_HOST=172.17.0.1 DOCKER_HOST_HTTP="http://172.17.0.1" make
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send coverage
run: goveralls -coverprofile=coverage.txt -service=github -parallel
- uses: actions/upload-artifact@v4
with:
name: logs-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.go-version }}.zip
path: ~/.pact/plugins/**/plugin.log
if: ${{ always() }}
# - name: Install goveralls
# run: go install github.com/mattn/goveralls@latest
# - name: Send coverage
# run: goveralls -coverprofile=coverage.txt -service=github -parallel
# - uses: actions/upload-artifact@v4
# with:
# name: logs-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.go-version }}.zip
# path: ~/.pact/plugins/**/plugin.log
# if: ${{ always() }}

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
# finish:
# needs: test
# runs-on: ubuntu-latest
# steps:
# - name: Coveralls Finished
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ coverage.txt
.vscode

# Dependencies
pact
pact

# pact files
examples/pacts/*
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,33 @@ deps: download_plugins
go install github.com/mitchellh/gox@latest; \
cd -

PLUGIN_PACT_PROTOBUF_VERSION=0.3.13
PLUGIN_PACT_CSV_VERSION=0.0.1
PLUGIN_PACT_MATT_VERSION=0.0.9
PLUGIN_PACT_AVRO_VERSION=0.0.3

download_plugins:
@echo "--- 🐿 Installing plugins"; \
./scripts/install-cli.sh
~/.pact/bin/pact-plugin-cli -y install https://github.com/pactflow/pact-protobuf-plugin/releases/tag/v-0.3.13
~/.pact/bin/pact-plugin-cli -y install https://github.com/pact-foundation/pact-plugins/releases/tag/csv-plugin-0.0.1
~/.pact/bin/pact-plugin-cli -y install https://github.com/mefellows/pact-matt-plugin/releases/tag/v0.0.9
~/.pact/bin/pact-plugin-cli -y install https://github.com/austek/pact-avro-plugin/releases/tag/v0.0.3
if [ ! -f ~/.pact/bin/pact-plugin-cli ]; then \
./scripts/install-cli.sh; \
else \
echo "--- 🐿 Pact CLI already installed"; \
fi
if [ ! -f ~/.pact/plugins/protobuf-$(PLUGIN_PACT_PROTOBUF_VERSION)/pact-protobuf-plugin ]; then \
~/.pact/bin/pact-plugin-cli -y install https://github.com/pactflow/pact-protobuf-plugin/releases/tag/v-$(PLUGIN_PACT_PROTOBUF_VERSION); \
else \
echo "--- 🐿 Pact protobuf plugin already installed"; \
fi
if [ ! -f ~/.pact/plugins/csv-$(PLUGIN_PACT_CSV_VERSION)/pact-csv-plugin ]; then \
~/.pact/bin/pact-plugin-cli -y install https://github.com/pact-foundation/pact-plugins/releases/tag/csv-plugin-$(PLUGIN_PACT_CSV_VERSION); \
fi
if [ ! -f ~/.pact/plugins/matt-$(PLUGIN_PACT_MATT_VERSION)/matt ]; then \
~/.pact/bin/pact-plugin-cli -y install https://github.com/mefellows/pact-matt-plugin/releases/tag/v$(PLUGIN_PACT_MATT_VERSION); \
fi
if [ ! -f ~/.pact/plugins/avro-$(PLUGIN_PACT_AVRO_VERSION)/bin/pact-avro-plugin ]; then \
~/.pact/bin/pact-plugin-cli -y install https://github.com/austek/pact-avro-plugin/releases/tag/v$(PLUGIN_PACT_AVRO_VERSION); \
fi


cli:
@if [ ! -d pact/bin ]; then\
Expand Down
4 changes: 4 additions & 0 deletions scripts/install-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ function detect_osarch() {
os='linux'
arch='x86_64'
;;
'Linux aarch64')
os='linux'
arch='aarch64'
;;
'Darwin x86' | 'Darwin x86_64')
os='osx'
arch='x86_64'
Expand Down

0 comments on commit 844ed97

Please sign in to comment.