From 84d1aa7e49dffa3aff5c0f2aa66750e075f96ff4 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Wed, 12 Jul 2023 14:50:08 +0100 Subject: [PATCH] feat: upgrade pact-ruby-standalone to 2.0.3 - Supports ARM64 MacOS / Linux - Drops support for 32bit Linux - Adds support for 32bit / 64bt Windows - Add CI tests for ARM64 MacOS / Linux --- .cirrus.yml | 45 +++++++++++++++++++++++++++++ .github/workflows/golangci-lint.yml | 4 +-- .github/workflows/test.yml | 2 +- Dockerfile | 6 ++-- Makefile | 5 +++- README.md | 7 +++-- scripts/pact.ps1 | 3 +- 7 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 .cirrus.yml diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 000000000..6dc18659e --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,45 @@ +test_task_template: &TEST_TASK_TEMPLATE + modules_cache: + fingerprint_script: cat go.sum + folder: $GOPATH/pkg/mod + deps_script: make deps + clean_script: make clean + bin_script: make bin + test_script: make test + +linux_test_task: + env: + matrix: + - VERSION: 1.17 + - VERSION: 1.18 + name: Tests (Go $VERSION) + container: + image: golang:$VERSION + <<: *TEST_TASK_TEMPLATE + +linux_arm64_test_task: + env: + matrix: + - VERSION: 1.17 + - VERSION: 1.18 + name: Tests (Go $VERSION) + arm_container: + image: golang:$VERSION + <<: *TEST_TASK_TEMPLATE + +macos_arm64_test_task: + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-base:latest + pre_req_script: brew install gox + <<: *TEST_TASK_TEMPLATE + +lint_task: + name: GolangCI Lint + container: + image: golangci/golangci-lint:latest + run_script: golangci-lint run -v --out-format json > lint-report.json + always: + golangci_artifacts: + path: lint-report.json + type: text/json + format: golangci \ No newline at end of file diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c1a6ac1c9..7bc864a34 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,9 +12,9 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.29 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a57965c93..6c11f5cdb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Test run: GIT_BRANCH=${GIT_REF:11} DOCKER_GATEWAY_HOST=172.17.0.1 DOCKER_HOST_HTTP="http://172.17.0.1" make - name: Install goveralls diff --git a/Dockerfile b/Dockerfile index 96d1a1428..c10acff99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM golang:1.18 # Install pact ruby standalone binaries -RUN curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.88.78/pact-1.88.78-linux-x86_64.tar.gz; \ - tar -C /usr/local -xzf pact-1.88.78-linux-x86_64.tar.gz; \ - rm pact-1.88.78-linux-x86_64.tar.gz +RUN curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v2.0.3/pact-2.0.3-linux-x86_64.tar.gz; \ + tar -C /usr/local -xzf pact-2.0.3-linux-x86_64.tar.gz; \ + rm pact-2.0.3-linux-x86_64.tar.gz ENV PATH /usr/local/pact/bin:$PATH diff --git a/Makefile b/Makefile index 206848dc7..0500229f7 100755 --- a/Makefile +++ b/Makefile @@ -14,9 +14,10 @@ docker: bin: gox -os="darwin" -arch="amd64" -output="build/pact-go_{{.OS}}_{{.Arch}}" gox -os="darwin" -arch="arm64" -output="build/pact-go_{{.OS}}_{{.Arch}}" + gox -os="windows" -arch="amd64" -output="build/pact-go_{{.OS}}_{{.Arch}}" gox -os="windows" -arch="386" -output="build/pact-go_{{.OS}}_{{.Arch}}" - gox -os="linux" -arch="386" -output="build/pact-go_{{.OS}}_{{.Arch}}" gox -os="linux" -arch="amd64" -output="build/pact-go_{{.OS}}_{{.Arch}}" + gox -os="linux" -arch="arm64" -output="build/pact-go_{{.OS}}_{{.Arch}}" @echo "==> Results:" ls -hl build/ @@ -34,6 +35,8 @@ install: echo "--- 🐿 Installing Pact CLI dependencies"; \ curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | bash -x; \ fi +# NOTE: pins pact-ruby-standalone to a fixed version +# curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | tag=v2.0.3 bash -x; \ publish_pacts: @echo "\n========== STAGE: publish pacts ==========\n" diff --git a/README.md b/README.md index 6b517a2b8..72bec2f8a 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ Read [Getting started with Pact] for more information for beginners. - [Pact Go](#pact-go) - [Introduction](#introduction) - - [Announcement 📣](#announcement-) - [Table of Contents](#table-of-contents) - [Versions](#versions) - [Installation](#installation) @@ -145,7 +144,11 @@ Test the installation: pact help ``` -_NOTE_: the above script installs the latest standalone tools at the time it was ran. It is recommended you pin the installation to a [specific version](https://github.com/pact-foundation/pact-ruby-standalone/releases) of a release so that you may control the upgrade cycle. +_NOTE_: the above script installs the latest standalone tools at the time it was ran. It is recommended you pin the installation to a [specific version](https://github.com/pact-foundation/pact-ruby-standalone/releases) of a release so that you may control the upgrade cycle, as shown below with `tag=v1.92.0` + +```sh +curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | tag=v1.92.0 bash +``` ## Using Pact diff --git a/scripts/pact.ps1 b/scripts/pact.ps1 index bc7ce679f..219491ee0 100644 --- a/scripts/pact.ps1 +++ b/scripts/pact.ps1 @@ -23,8 +23,9 @@ $downloadDir = $env:TEMP $latestRelease = Invoke-WebRequest https://github.com/pact-foundation/pact-ruby-standalone/releases/latest -Headers @{"Accept"="application/json"} $json = $latestRelease.Content | ConvertFrom-Json $tag = $json.tag_name +# $tag = "v2.0.3" # NOTE: pins pact-ruby-standalone to a fixed version $latestVersion = $tag.Substring(1) -$url = "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/$tag/pact-$latestVersion-win32.zip" +$url = "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/$tag/pact-$latestVersion-windows-x86.zip" Write-Host "Downloading $url" $zip = "$downloadDir\pact.zip"