forked from pact-foundation/pact-go
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (123 loc) · 4.26 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
on: [push, pull_request, workflow_dispatch]
name: Test
env:
PACT_BROKER_BASE_URL: https://testdemo.pactflow.io
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
APP_SHA: ${{ github.sha }}
APP_REF: ${{ github.ref }}
LD_LIBRARY_PATH: /tmp
PACT_GO_LIB_DOWNLOAD_PATH: /tmp
LOG_LEVEL: info
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACT_DO_NOT_TRACK: true
jobs:
test:
strategy:
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 8 Aug 2023
'1.20', # Ended 06 Feb 2024
'1.21',
'1.22'
]
os: [
ubuntu-22.04, # We use this OS to run a build against our docker image
ubuntu-latest,
macos-12,
macos-14
]
experimental: [false]
exclude:
- go-version: '1.22'
os: ubuntu-latest
- go-version: '1.22'
os: ubuntu-22.04
- go-version: '1.22'
os: macos-12
include:
- go-version: '1.22'
os: ubuntu-latest
experimental: true
- go-version: '1.22'
os: ubuntu-22.04
experimental: true
- go-version: '1.22'
os: macos-12
experimental: true
fail-fast: false
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
name: ${{ matrix.os == 'ubuntu-22.04' && 'linux-docker' || matrix.os }}-${{ matrix.go-version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
if: matrix.os != 'ubuntu-22.04'
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- uses: actions/setup-java@v4 # Needed for the Avro example
if: matrix.os != 'ubuntu-22.04'
with:
distribution: 'zulu'
java-version: '17'
- run: brew install protobuf
if: matrix.os == 'macos-14'
- name: Unit Test
if: matrix.os != 'ubuntu-22.04'
run: make ci_unit
- name: Build amd64 dockerfile
if: matrix.os == 'ubuntu-22.04'
run: |
docker build \
--platform linux/amd64 \
--build-arg VERSION=${{ matrix.go-version }} \
-f Dockerfile \
-t pactfoundation/pact-go-test-${{ matrix.go-version }} .
- name: Unit Test (amd64 docker)
if: matrix.os == 'ubuntu-22.04'
run: |
docker run \
--platform linux/amd64 \
--rm pactfoundation/pact-go-test-${{ matrix.go-version }}
- name: Examples with Standalone (amd64 docker)
if: matrix.os == 'ubuntu-22.04'
run: |
docker run \
--platform linux/amd64 \
-e PACT_BROKER_BASE_URL \
-e PACT_BROKER_TOKEN \
-e LOG_LEVEL \
-e APP_SHA \
-e PACT_DO_NOT_TRACK \
-e APP_BRANCH=${APP_REF:11} \
--rm \
pactfoundation/pact-go-test-${{ matrix.go-version }} \
/bin/sh -c "make download_plugins && make install-pact-ruby-cli && PACT_TOOL=ruby make pact"
- name: Examples with Standalone
if: matrix.os != 'ubuntu-22.04'
run: |
make install-pact-ruby-standalone
APP_BRANCH=${APP_REF:11} PACT_TOOL=standalone make ci_hosted_examples
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
if: runner.os == 'Linux' && matrix.os != 'ubuntu-22.04'
- name: Send coverage
run: goveralls -coverprofile=coverage.txt -service=github -parallel
if: runner.os == 'Linux' && matrix.os != 'ubuntu-22.04'
- 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() && matrix.os != 'ubuntu-22.04' }}
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