From 844ed97b8fc5f765b620cf8360308b8e2ef5ebce Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 2 May 2024 20:16:14 +0100 Subject: [PATCH] ci: macos-12 / 14 - use colima for docker --- .github/workflows/test.yml | 53 +++++++++++++++++++++----------------- .gitignore | 5 +++- Makefile | 30 +++++++++++++++++---- scripts/install-cli.sh | 4 +++ 4 files changed, 62 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bde9f7c4a..d54ec5f3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index dddbec92a..86e47afb8 100644 --- a/.gitignore +++ b/.gitignore @@ -50,4 +50,7 @@ coverage.txt .vscode # Dependencies -pact \ No newline at end of file +pact + +# pact files +examples/pacts/* \ No newline at end of file diff --git a/Makefile b/Makefile index f604fc0be..22938bed2 100755 --- a/Makefile +++ b/Makefile @@ -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\ diff --git a/scripts/install-cli.sh b/scripts/install-cli.sh index 2ae7f9f1e..13bd273d9 100755 --- a/scripts/install-cli.sh +++ b/scripts/install-cli.sh @@ -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'