Skip to content

Commit 759a9d7

Browse files
authored
Merge pull request #324 from rust-random/ci
Improve CI and update runners
2 parents 5a4a8ea + f096c04 commit 759a9d7

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

.github/workflows/tests.yml

+33-30
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
jobs:
1616
check-doc:
1717
name: Docs, deadlinks, minimal dependencies
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04
1919
steps:
2020
- uses: actions/checkout@v3
2121
- uses: dtolnay/rust-toolchain@nightly # Needed for -Z minimal-versions and doc_cfg
@@ -41,11 +41,11 @@ jobs:
4141
runs-on: ${{ matrix.os }}
4242
strategy:
4343
matrix:
44-
os: [ubuntu-latest, windows-latest]
44+
os: [ubuntu-22.04, windows-2022]
4545
toolchain: [nightly, beta, stable, 1.36]
4646
# Only Test macOS on stable to reduce macOS CI jobs
4747
include:
48-
- os: macos-latest
48+
- os: macos-12
4949
toolchain: stable
5050
steps:
5151
- uses: actions/checkout@v3
@@ -61,7 +61,7 @@ jobs:
6161

6262
linux-tests:
6363
name: Linux Test
64-
runs-on: ubuntu-latest
64+
runs-on: ubuntu-22.04
6565
strategy:
6666
matrix:
6767
target: [
@@ -75,17 +75,13 @@ jobs:
7575
with:
7676
targets: ${{ matrix.target }}
7777
- name: Install multilib
78-
# update is needed to fix the 404 error on install, see:
79-
# https://github.com/actions/virtual-environments/issues/675
80-
run: |
81-
sudo apt-get update
82-
sudo apt-get install gcc-multilib
78+
run: sudo apt-get install gcc-multilib
8379
- uses: Swatinem/rust-cache@v2
8480
- run: cargo test --target=${{ matrix.target }} --features=std
8581

8682
ios-tests:
8783
name: iOS Simulator Test
88-
runs-on: macos-11
84+
runs-on: macos-12
8985
steps:
9086
- uses: actions/checkout@v3
9187
- uses: dtolnay/rust-toolchain@stable
@@ -98,9 +94,15 @@ jobs:
9894
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
9995
cargo dinghy --version
10096
- name: Setup Simulator
97+
# Use the first installed iOS runtime and the first (i.e. oldest) supported iPhone device.
10198
run: |
102-
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
103-
SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID)
99+
RUNTIME=$(xcrun simctl list runtimes --json | jq '.runtimes | map(select(.name | contains("iOS"))) | .[0]')
100+
RUNTIME_ID=$(echo $RUNTIME | jq -r '.identifier')
101+
echo "Using runtime:" $RUNTIME_ID
102+
DEVICE_ID=$(echo $RUNTIME | jq -r '.supportedDeviceTypes | map(select(.productFamily == "iPhone")) | .[0].identifier')
103+
echo "Using device:" $DEVICE_ID
104+
SIM_ID=$(xcrun simctl create Test-iPhone $DEVICE_ID $RUNTIME_ID)
105+
echo "Created simulator:" $SIM_ID
104106
xcrun simctl boot $SIM_ID
105107
echo "device=$SIM_ID" >> $GITHUB_ENV
106108
- uses: Swatinem/rust-cache@v2
@@ -109,7 +111,7 @@ jobs:
109111

110112
windows-tests:
111113
name: Windows Test
112-
runs-on: windows-latest
114+
runs-on: windows-2022
113115
strategy:
114116
matrix:
115117
toolchain: [
@@ -127,7 +129,7 @@ jobs:
127129

128130
cross-tests:
129131
name: Cross Test
130-
runs-on: ubuntu-latest
132+
runs-on: ubuntu-22.04
131133
strategy:
132134
matrix:
133135
target: [
@@ -150,7 +152,7 @@ jobs:
150152

151153
macos-link:
152154
name: macOS ARM64 Build/Link
153-
runs-on: macos-latest
155+
runs-on: macos-12
154156
steps:
155157
- uses: actions/checkout@v3
156158
- uses: dtolnay/rust-toolchain@nightly
@@ -164,7 +166,7 @@ jobs:
164166

165167
cross-link:
166168
name: Cross Build/Link
167-
runs-on: ubuntu-latest
169+
runs-on: ubuntu-22.04
168170
strategy:
169171
matrix:
170172
target: [
@@ -191,24 +193,25 @@ jobs:
191193
fail-fast: false
192194
matrix:
193195
include:
194-
- os: ubuntu-latest
195-
target: x86_64-unknown-linux-musl
196-
- os: windows-latest
197-
target: x86_64-pc-windows-msvc
196+
# Firefox isn't available on 22.04 yet, so we must use 20.04
197+
- os: ubuntu-20.04
198+
host: x86_64-unknown-linux-musl
199+
- os: windows-2022
200+
host: x86_64-pc-windows-msvc
198201
# Reenable when Safari tests start working
199202
# - os: macos-12
200-
# target: x86_64-apple-darwin
203+
# host: x86_64-apple-darwin
201204
runs-on: ${{ matrix.os }}
202205
steps:
203206
- uses: actions/checkout@v3
204207
- uses: dtolnay/rust-toolchain@stable
205208
- run: choco install wget
206-
if: matrix.os == 'windows-latest'
209+
if: runner.os == 'Windows'
207210
- name: Install precompiled wasm-pack
208211
shell: bash
209212
run: |
210213
VERSION=v0.10.3
211-
URL=https://github.com/rustwasm/wasm-pack/releases/download/${VERSION}/wasm-pack-${VERSION}-${{ matrix.target }}.tar.gz
214+
URL=https://github.com/rustwasm/wasm-pack/releases/download/${VERSION}/wasm-pack-${VERSION}-${{ matrix.host }}.tar.gz
212215
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
213216
wasm-pack --version
214217
- uses: Swatinem/rust-cache@v2
@@ -219,18 +222,18 @@ jobs:
219222
- name: Test (Chrome)
220223
run: wasm-pack test --headless --chrome --features=js,test-in-browser
221224
- name: Test (Edge)
222-
if: matrix.os == 'windows-latest'
225+
if: runner.os == 'Windows'
223226
run: wasm-pack test --headless --chrome --chromedriver $Env:EDGEWEBDRIVER\msedgedriver.exe --features=js,test-in-browser
224227
# Safari tests are broken: https://github.com/rustwasm/wasm-bindgen/issues/3004
225228
# - name: Test (Safari)
226-
# if: matrix.os == 'macos-12'
229+
# if: runner.os == 'macOS'
227230
# run: wasm-pack test --headless --safari --features=js,test-in-browser
228231
- name: Test (custom getrandom)
229232
run: wasm-pack test --node --features=custom
230233

231234
wasm64-tests:
232235
name: wasm64 Build/Link
233-
runs-on: ubuntu-latest
236+
runs-on: ubuntu-22.04
234237
steps:
235238
- uses: actions/checkout@v3
236239
- uses: dtolnay/rust-toolchain@nightly # Need to build libstd
@@ -245,7 +248,7 @@ jobs:
245248

246249
wasi-tests:
247250
name: WASI Test
248-
runs-on: ubuntu-latest
251+
runs-on: ubuntu-22.04
249252
steps:
250253
- uses: actions/checkout@v3
251254
- uses: dtolnay/rust-toolchain@stable
@@ -262,7 +265,7 @@ jobs:
262265

263266
build-tier2:
264267
name: Tier 2 Build
265-
runs-on: ubuntu-latest
268+
runs-on: ubuntu-22.04
266269
strategy:
267270
matrix:
268271
target: [
@@ -281,7 +284,7 @@ jobs:
281284

282285
build-tier3:
283286
name: Tier 3 Build
284-
runs-on: ubuntu-latest
287+
runs-on: ubuntu-22.04
285288
strategy:
286289
matrix:
287290
# Supported tier 3 targets without libstd support
@@ -318,7 +321,7 @@ jobs:
318321

319322
clippy-fmt:
320323
name: Clippy + rustfmt
321-
runs-on: ubuntu-latest
324+
runs-on: ubuntu-22.04
322325
steps:
323326
- uses: actions/checkout@v1
324327
- uses: dtolnay/rust-toolchain@stable

0 commit comments

Comments
 (0)