-
Notifications
You must be signed in to change notification settings - Fork 1
224 lines (224 loc) Β· 7.5 KB
/
build-and-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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: π Build and Release
on:
push:
branches-ignore: [wip/**]
tags: ["**"]
pull_request:
env:
CRATE_NAME: pgxn_meta
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
permissions:
contents: write
jobs:
release:
name: ${{ matrix.platform.emoji }} ${{ matrix.platform.os_name }} π¦ ${{ matrix.toolchain }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
# https://github.com/cross-rs/cross#supported-targets
platform:
- os_name: freebsd-amd64
os: ubuntu-20.04
target: x86_64-unknown-freebsd
bin: pgxn_meta
emoji: π
skip_tests: true
- os_name: freebsd-i686
os: ubuntu-20.04
target: i686-unknown-freebsd
bin: pgxn_meta
emoji: π
skip_tests: true
- os_name: linux-amd64
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
bin: pgxn_meta
emoji: π§
- os_name: linux-arm64
os: ubuntu-20.04
target: aarch64-unknown-linux-musl
bin: pgxn_meta
emoji: π§
- os_name: linux-arm
os: ubuntu-20.04
target: arm-unknown-linux-musleabi
bin: pgxn_meta
emoji: π§
- os_name: linux-i686
os: ubuntu-20.04
target: i686-unknown-linux-musl
bin: pgxn_meta
emoji: π§
- os_name: linux-powerpc
os: ubuntu-20.04
target: powerpc-unknown-linux-gnu
bin: pgxn_meta
emoji: π§
- os_name: linux-powerpc64
os: ubuntu-20.04
target: powerpc64-unknown-linux-gnu
bin: pgxn_meta
emoji: π§
- os_name: linux-powerpc64le
os: ubuntu-20.04
target: powerpc64le-unknown-linux-gnu
bin: pgxn_meta
emoji: π§
- os_name: linux-riscv64
os: ubuntu-20.04
target: riscv64gc-unknown-linux-gnu
bin: pgxn_meta
emoji: π§
- os_name: linux-s390x
os: ubuntu-20.04
target: s390x-unknown-linux-gnu
bin: pgxn_meta
emoji: π§
- os_name: linux-sparc64
os: ubuntu-20.04
target: sparc64-unknown-linux-gnu
bin: pgxn_meta
emoji: π§
- os_name: netbsd-amd64
os: ubuntu-20.04
target: x86_64-unknown-netbsd
bin: pgxn_meta
emoji: β³οΈ
skip_tests: true
- os_name: windows-arm64
os: windows-latest
target: aarch64-pc-windows-msvc
bin: pgxn_meta.exe
emoji: πͺ
skip_tests: true
- os_name: windows-i686
os: windows-latest
target: i686-pc-windows-msvc
bin: pgxn_meta.exe
emoji: πͺ
- os_name: windows-amd64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: pgxn_meta.exe
emoji: πͺ
- os_name: darwin-amd64
os: macos-latest
target: x86_64-apple-darwin
bin: pgxn_meta
emoji: π
- os_name: darwin-arm64
os: macos-latest
target: aarch64-apple-darwin
bin: pgxn_meta
emoji: π
- os_name: illumos-amd64
os: ubuntu-20.04
target: x86_64-unknown-illumos
bin: pgxn_meta
emoji: π¦βπ₯
skip_tests: true
- os_name: solaris-sparcv9
os: ubuntu-20.04
target: sparcv9-sun-solaris
bin: pgxn_meta
emoji: βοΈ
skip_tests: true
- os_name: solaris-amd64
os: ubuntu-20.04
target: x86_64-pc-solaris
bin: pgxn_meta
emoji: βοΈ
skip_tests: true
# Dragonfly: No std component available.
# - os_name: dragonfly-amd64
# os: ubuntu-20.04
# target: x86_64-unknown-dragonfly
# bin: pgxn_meta
# emoji: ππͺ°
# skip_tests: true
toolchain:
- stable
- beta
- nightly
exclude:
# Not sure why this is failing.
- toolchain: nightly
platform: { os_name: linux-arm64 }
steps:
- uses: actions/checkout@v4
- name: Setup Cache
uses: Swatinem/rust-cache@v2
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.platform.name, 'musl')
- name: Build Binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
cross-version: 7b79041 # Until upgrade from 0.2.5 to support solaris-amd64
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
args: "--locked --release"
strip: true
- name: Run Tests
uses: houseabsolute/actions-rust-cross@v0
with:
command: test
cross-version: 7b79041 # Until upgrade from 0.2.5 to support solaris-amd64
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
args: "--locked --release"
if: ${{ !matrix.platform.skip_tests }}
- name: Get the Version
if: env.VERSION == ''
shell: bash
run: echo "VERSION=$(grep "^version" Cargo.toml | sed -r 's/version[^"]+"([^"]+).*/\1/')" >> $GITHUB_ENV
- name: Determine Archive Name
shell: bash
run: |
echo "ARCHIVE=pgxn_meta-v$VERSION-${{ matrix.platform.os_name }}" >> $GITHUB_ENV
- name: Package Archive
shell: bash
run: |
printf "Packaging %s\n" "$ARCHIVE"
mkdir "$ARCHIVE"
cp "target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}" "$ARCHIVE"/
cp {README.md,CHANGELOG.md,LICENSE.md} "$ARCHIVE"/
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
7z a "$ARCHIVE.zip" "$ARCHIVE"
else
tar czvf "$ARCHIVE.tar.gz" "$ARCHIVE"
fi
if: |
matrix.toolchain == 'stable' &&
( startsWith( github.ref, 'refs/tags/v' ) ||
github.ref == 'refs/tags/test-release' )
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
path: "${{ env.ARCHIVE }}.*"
name: "${{ env.ARCHIVE }}"
overwrite: true
if: matrix.toolchain == 'stable' && github.ref == 'refs/tags/test-release'
- name: Check the Version
shell: bash
run: |
if [ "${{ github.ref_name }}" != "v$VERSION" ]; then
printf "Cargo.toml version %s does not match tag %s\n" "$VERSION" "${{ github.ref_name }}" >&2
exit 1
fi
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
- name: Generate Release Notes
id: notes
uses: theory/changelog-version-notes-action@v0
with: { version: "v${{ env.VERSION }}" }
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
name: "Relelase ${{ env.VERSION }}"
files: "pgxn_meta-*"
body_path: ${{ steps.notes.outputs.file }}
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )