-
Notifications
You must be signed in to change notification settings - Fork 70
161 lines (128 loc) · 3.86 KB
/
_build-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
name: Release Build
on:
workflow_call:
inputs:
# Must start with 'v'
scarb-tag:
required: true
type: string
ref:
required: false
type: string
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
env:
# Cross-compiled targets will override this to `cross`.
CARGO: cargo
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
# Use cross to link oldest GLIBC possible.
cross: true
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: true
#- target: armv7-unknown-linux-gnueabihf
# os: ubuntu-latest
# cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-13
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-pc-windows-msvc
os: windows-latest
#- target: aarch64-pc-windows-msvc
# os: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
uses: taiki-e/install-action@cross
- name: Enable cross-compilation
if: matrix.cross
shell: bash
run: echo "CARGO=cross" >> $GITHUB_ENV
- name: Build
run: ${{ env.CARGO }} build --release --locked --target ${{ matrix.target }}
- name: Create archive
run: cargo xtask create-archive
env:
STAGING: scarb-${{ inputs.scarb-tag }}-${{ matrix.target }}
TARGET: ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.target }}
path: scarb-${{ inputs.scarb-tag }}-${{ matrix.target }}.*
verify:
name: verify ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-pc-windows-msvc
os: windows-2019
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: dtolnay/rust-toolchain@stable
- name: Build xtasks
run: cargo build -p xtask
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.target }}
path: target/verify
- name: Verify archive
shell: bash
run: |
archive=$(find target/verify -name 'scarb-*.zip' -o -name 'scarb-*.tar.gz')
cargo xtask verify-archive --archive "$archive"
env:
EXPECTED_VERSION: ${{ inputs.scarb-tag }}
checksums:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts-dl
- name: Unpack artifacts to staging directory
run: |
mkdir -p artifacts
mv artifacts-dl/build-*/scarb-* artifacts/
- name: Compute checksums
working-directory: artifacts
run: |
sha256sum -b scarb-* > checksums.sha256
cat checksums.sha256
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: checksums
path: artifacts/checksums.*