Skip to content

Commit

Permalink
feat: upgrade pact-ruby-standalone to 2.0.3
Browse files Browse the repository at this point in the history
- Supports ARM64 MacOS / Linux
- Drops support for 32bit Linux
- Adds support for 32bit / 64bt Windows
- Add CI tests for ARM64 MacOS / Linux
  • Loading branch information
YOU54F committed Jul 12, 2023
1 parent 88a372a commit 84d1aa7
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 10 deletions.
45 changes: 45 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand All @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion scripts/pact.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 84d1aa7

Please sign in to comment.