-
Notifications
You must be signed in to change notification settings - Fork 46
159 lines (138 loc) · 4.66 KB
/
release.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Release workflow
on:
release:
types:
- published
pull_request:
branches:
- master
workflow_dispatch:
schedule:
- cron: 0 0 * * 4 # Midnight Wednesday
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
jobs:
build-release:
name: build-release (${{ matrix.targets }})
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
include:
- operating-system: ubuntu-20.04
targets: x86_64-unknown-linux-gnu
- operating-system: ubuntu-20.04
targets: x86_64-unknown-linux-musl
- operating-system: ubuntu-20.04
targets: aarch64-unknown-linux-gnu
- operating-system: ubuntu-20.04
targets: aarch64-unknown-linux-musl
- operating-system: windows-2019
targets: x86_64-pc-windows-msvc
- operating-system: windows-2019
targets: aarch64-pc-windows-msvc
- operating-system: macos-12
targets: x86_64-apple-darwin
- operating-system: macos-14
targets: aarch64-apple-darwin
fail-fast: false
env:
pact_do_not_track: true
steps:
- uses: actions/checkout@v4
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.targets }}
- name: Rust caching
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
key: ${{ matrix.targets }}
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v3
- name: Platform abbreviation
id: platform-abbreviation
shell: bash
run: |
if [[ "${{ runner.os }}" = "Linux" ]]; then
echo "platform=linux" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" = "Windows" ]]; then
echo "platform=win" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" = "macOS" ]]; then
echo "platform=macos" >> "$GITHUB_OUTPUT"
else
echo "Unknown platform"
exit 1
fi
- name: Cargo flags
id: cargo-flags
shell: bash
run: |
echo "flags=--release" >> "$GITHUB_OUTPUT"
- name: Build verifier CLI
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref, 'refs/tags/pact_verifier_cli')
shell: bash
run: |
./release-${{ steps.platform-abbreviation.outputs.platform }}.sh ${{ matrix.targets }} \
${{ steps.cargo-flags.outputs.flags }}
working-directory: rust/pact_verifier_cli
- name: Build FFI library
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref, 'refs/tags/libpact_ffi')
shell: bash
run: |
./release-${{ steps.platform-abbreviation.outputs.platform }}.sh ${{ matrix.targets }} \
${{ steps.cargo-flags.outputs.flags }}
working-directory: rust/pact_ffi
- name: Smoke Test FFI library
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref, 'refs/tags/libpact_ffi')
shell: bash
run: |
./smoke-test.sh ${{ matrix.targets }}
working-directory: ruby
- name: Upload the artifacts
if: |
startsWith(github.ref, 'refs/tags/libpact_ffi') ||
startsWith(github.ref, 'refs/tags/pact_verifier_cli')
uses: actions/upload-artifact@v4
with:
name: release-artifacts-${{ matrix.targets }}
path: rust/release_artifacts
if-no-files-found: warn
publish:
runs-on: ubuntu-latest
if: |
startsWith(github.ref, 'refs/tags/libpact_ffi') ||
startsWith(github.ref, 'refs/tags/pact_verifier_cli')
needs: build-release
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: release-artifacts-*
path: rust/release_artifacts
merge-multiple: true
- name: Upload Release Assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: rust/release_artifacts/*
file_glob: true
tag: ${{ github.ref }}