Skip to content

Commit

Permalink
ci: reinstate all platforms and merge win
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Jun 29, 2024
1 parent 9b2b93b commit af9e307
Showing 1 changed file with 115 additions and 113 deletions.
228 changes: 115 additions & 113 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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_DO_NOT_TRACK: true
APP_SHA: ${{ github.sha }}
APP_REF: ${{ github.ref }}
# LD_LIBRARY_PATH: /tmp
Expand All @@ -13,118 +13,19 @@ env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
# test:
# strategy:
# fail-fast: false
# matrix:
# go-version: [ # https://endoflife.date/go
# # 1.17.x, # Ended 02 Aug 2022
# # 1.18.x, # Ended 01 Feb 2023
# # 1.19.x, # Ended 06 Sep 2023
# 1.20.x, # Ended 06 Feb 2024
# 1.21.x,
# 1.22.x,
# ]
# os: [ubuntu-latest, macos-12, macos-14]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Install Go
# uses: actions/setup-go@v5
# with:
# go-version: ${{ matrix.go-version }}
# - uses: actions/setup-java@v4 # Needed for the Avro example
# with:
# distribution: 'zulu'
# java-version: '17'
# - if: matrix.os == 'macos-14'
# run: brew install protobuf
# - name: Test
# if: matrix.os == 'ubuntu-latest'
# run: APP_BRANCH=${APP_REF:11} DOCKER_GATEWAY_HOST=172.17.0.1 DOCKER_HOST_HTTP="http://172.17.0.1" make
# - name: Test (unit)
# if: matrix.os != 'ubuntu-latest'
# run: make test
# - name: Test (pact)
# if: matrix.os != 'ubuntu-latest'
# run: make pact_local
# - 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 }}-${{ matrix.os }}.zip
# path: ~/.pact/plugins/**/plugin.log
# if: ${{ always() }}

# test-containers:
# runs-on: ubuntu-latest
# name: ${{ matrix.variant }}-${{ matrix.arch }}-${{ matrix.go-version }}-test-container
# strategy:
# fail-fast: false
# matrix:
# arch:
# - amd64
# # - arm64
# go-version: ["1.20", "1.21", "1.22"]
# variant:
# - debian
# # - alpine
# steps:
# - uses: actions/checkout@v4
# - name: Set up Docker Buildx
# if: matrix.arch != 'amd64'
# uses: docker/setup-buildx-action@v3
# with:
# platforms: ${{ matrix.arch }}

# - name: Build ${{ matrix.arch }} dockerfile
# run: |
# docker build \
# --platform ${{ matrix.arch }} \
# --build-arg VERSION=${{ matrix.go-version }} \
# -f Dockerfile.${{ matrix.variant }} \
# -t pactfoundation/pact-go-test-${{ matrix.go-version }} .

# - name: Test - ${{ matrix.arch }}
# if: matrix.arch == 'amd64'
# run: |
# docker run \
# --platform linux/${{ matrix.arch }} \
# -e LOG_LEVEL=${{ env.LOG_LEVEL }} \
# --rm pactfoundation/pact-go-test-${{ matrix.go-version }} /bin/sh -c 'make test && make pact_local'

# - name: Test - ${{ matrix.arch }}
# if: matrix.arch == 'arm64'
# run: |
# docker run \
# --platform linux/${{ matrix.arch }} \
# -e LOG_LEVEL=${{ env.LOG_LEVEL }} \
# -e SKIP_RACE=true \
# --rm pactfoundation/pact-go-test-${{ matrix.go-version }} /bin/sh -c 'make test && make pact_local'

# finish:
# needs: [test,test-containers]
# runs-on: ubuntu-latest
# steps:
# - name: Coveralls Finished
# uses: coverallsapp/github-action@main
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true

test-win:
test:
strategy:
fail-fast: false
matrix:
go-version: [ # https://endoflife.date/go
# 1.17.x, # Ended 02 Aug 2022
# 1.18.x, # Ended 01 Feb 2023
# 1.19.x, # Ended 06 Sep 2023
1.20.x, # Ended 06 Feb 2024
1.21.x,
1.22.x,
]
os: [windows-latest]
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
Expand All @@ -133,20 +34,121 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- uses: actions/setup-java@v4 # Needed for the Avro example
with:
distribution: 'zulu'
java-version: '17'
- if: matrix.os == 'macos-14'
run: brew install protobuf
- name: Test
if: matrix.os == 'ubuntu-latest'
run: APP_BRANCH=${APP_REF:11} DOCKER_GATEWAY_HOST=172.17.0.1 DOCKER_HOST_HTTP="http://172.17.0.1" make
- name: Set CGO_LDFLAGS / pact_ffi lib on PATH, and skip Avro plugin download
if: matrix.os == 'windows-latest'
run: |
"CGO_LDFLAGS=-L$env:TMP" >> $env:GITHUB_ENV
"$env:TMP" >> $env:GITHUB_PATH
"SKIP_PLUGIN_AVRO=true" >> $env:GITHUB_ENV
# - name: Build
# run: .\scripts\build.ps1
# - name: Test (unit)
# run: .\scripts\unit.ps1
# - name: Test (consumer)
# run: .\scripts\examples_consumer.ps1
# - name: Test (provider)
# run: .\scripts\examples_provider.ps1
- name: Test (unit)
if: matrix.os != 'ubuntu-latest'
run: make test
- name: Test (pact)
if: matrix.os != 'ubuntu-latest'
run: make pact_local
- 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 }}-${{ matrix.os }}.zip
path: ~/.pact/plugins/**/plugin.log
if: ${{ always() }}

test-containers:
runs-on: ubuntu-latest
name: ${{ matrix.variant }}-${{ matrix.arch }}-${{ matrix.go-version }}-test-container
strategy:
fail-fast: false
matrix:
arch:
- amd64
# - arm64
go-version: ["1.20", "1.21", "1.22"]
variant:
- debian
# - alpine
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
if: matrix.arch != 'amd64'
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ matrix.arch }}

- name: Build ${{ matrix.arch }} dockerfile
run: |
docker build \
--platform ${{ matrix.arch }} \
--build-arg VERSION=${{ matrix.go-version }} \
-f Dockerfile.${{ matrix.variant }} \
-t pactfoundation/pact-go-test-${{ matrix.go-version }} .
- name: Test - ${{ matrix.arch }}
if: matrix.arch == 'amd64'
run: |
docker run \
--platform linux/${{ matrix.arch }} \
-e LOG_LEVEL=${{ env.LOG_LEVEL }} \
--rm pactfoundation/pact-go-test-${{ matrix.go-version }} /bin/sh -c 'make test && make pact_local'
- name: Test - ${{ matrix.arch }}
if: matrix.arch == 'arm64'
run: |
docker run \
--platform linux/${{ matrix.arch }} \
-e LOG_LEVEL=${{ env.LOG_LEVEL }} \
-e SKIP_RACE=true \
--rm pactfoundation/pact-go-test-${{ matrix.go-version }} /bin/sh -c 'make test && make pact_local'
finish:
needs: [test,test-containers]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

# test-win:
# strategy:
# fail-fast: false
# matrix:
# go-version: [ # https://endoflife.date/go
# 1.20.x, # Ended 06 Feb 2024
# 1.21.x,
# 1.22.x,
# ]
# os: [windows-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Install Go
# uses: actions/setup-go@v5
# with:
# go-version: ${{ matrix.go-version }}
# - name: Set CGO_LDFLAGS / pact_ffi lib on PATH, and skip Avro plugin download
# run: |
# "CGO_LDFLAGS=-L$env:TMP" >> $env:GITHUB_ENV
# "$env:TMP" >> $env:GITHUB_PATH
# "SKIP_PLUGIN_AVRO=true" >> $env:GITHUB_ENV
# - name: Build
# run: .\scripts\build.ps1
# - name: Test (unit)
# run: .\scripts\unit.ps1
# - name: Test (consumer)
# run: .\scripts\examples_consumer.ps1
# - name: Test (provider)
# run: .\scripts\examples_provider.ps1

0 comments on commit af9e307

Please sign in to comment.