Skip to content

Commit cd9aa50

Browse files
authored
ci: update runner images in release workflow (#91)
* ci: refresh the runner images in release.yml * fmt the workflow files * trigger release by pull_request, only publish for tag
1 parent af0d9c2 commit cd9aa50

File tree

2 files changed

+61
-45
lines changed

2 files changed

+61
-45
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,31 @@ name: Release
22
on:
33
push:
44
tags:
5-
- '*'
5+
- "*"
6+
pull_request:
7+
68
jobs:
79
build:
810
name: Build for ${{ matrix.name }}
911
runs-on: ${{ matrix.os }}
1012
strategy:
1113
fail-fast: false
14+
# The runner images are chosen to be one major version behind the latest.
15+
# The macOS runner should be x86_64 so that the binary can run on both Intel and Apple Silicon Macs.
16+
# For example, as of Sep 2025
17+
# - The latest Ubuntu is 24.04, so we use ubuntu-22.04
18+
# - The latest macOS is 15, so we use macos-14-large
1219
matrix:
1320
include:
14-
- os: ubuntu-20.04
21+
- os: ubuntu-22.04
1522
name: linux64
1623
artifact_name: target/release/ic-wasm
1724
asset_name: ic-wasm-linux64
18-
- os: ubuntu-20.04
25+
- os: ubuntu-22.04
1926
name: linux-musl
2027
artifact_name: target/release/ic-wasm
2128
asset_name: ic-wasm-linux-musl
22-
- os: macos-13
29+
- os: macos-14-large # x86_64 build that can run on both Intel and Apple Silicon Macs
2330
name: macos
2431
artifact_name: target/release/ic-wasm
2532
asset_name: ic-wasm-macos
@@ -43,7 +50,7 @@ jobs:
4350
cargo build --release --locked
4451
'
4552
46-
- name: 'Upload assets'
53+
- name: "Upload assets"
4754
uses: actions/upload-artifact@v4
4855
with:
4956
name: ${{ matrix.asset_name }}
@@ -56,17 +63,24 @@ jobs:
5663
runs-on: ${{ matrix.os }}
5764
strategy:
5865
fail-fast: false
66+
# The binaries built in the `build` job are tested on:
67+
# - Ubuntu: latest and one major version behind latest.
68+
# - macOS: latest and one major version behind latest. Both x86_64 and arm64 runner images.
5969
matrix:
6070
include:
61-
- os: ubuntu-22.04
62-
asset_name: ic-wasm-linux64
63-
- os: ubuntu-20.04
71+
- os: ubuntu-latest
6472
asset_name: ic-wasm-linux64
6573
- os: ubuntu-22.04
74+
asset_name: ic-wasm-linux64
75+
- os: ubuntu-latest
6676
asset_name: ic-wasm-linux-musl
67-
- os: ubuntu-20.04
77+
- os: ubuntu-22.04
6878
asset_name: ic-wasm-linux-musl
69-
- os: macos-13
79+
- os: macos-latest-large
80+
asset_name: ic-wasm-macos
81+
- os: macos-latest
82+
asset_name: ic-wasm-macos
83+
- os: macos-14-large
7084
asset_name: ic-wasm-macos
7185
- os: macos-14
7286
asset_name: ic-wasm-macos
@@ -92,6 +106,8 @@ jobs:
92106
./ic-wasm --version
93107
94108
publish:
109+
# Check if the workflow was triggered by a tag
110+
if: startsWith(github.ref, 'refs/tags/')
95111
needs: test
96112
name: Publish ${{ matrix.asset_name }}
97113
strategy:
@@ -130,4 +146,4 @@ jobs:
130146
repo_token: ${{ secrets.GITHUB_TOKEN }}
131147
file: ${{ matrix.binstall_name }}
132148
asset_name: ${{ matrix.binstall_name }}
133-
tag: ${{ github.ref }}
149+
tag: ${{ github.ref }}

.github/workflows/rust.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ jobs:
99
rust:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
- name: Cache cargo build
14-
uses: actions/cache@v4
15-
with:
16-
path: |
17-
~/.cargo/registry
18-
~/.cargo/git
19-
target
20-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/*.rs', '**/Cargo.toml') }}
21-
- name: Cache cargo binaries
22-
uses: actions/cache@v4
23-
with:
24-
path: ~/.cargo/bin
25-
key: cargo-bin-${{ runner.os }}-v1
26-
- name: Install cargo-sort if needed
27-
run: |
28-
if ! command -v cargo-sort &> /dev/null; then
29-
echo "Installing cargo-sort..."
30-
cargo install cargo-sort
31-
else
32-
echo "cargo-sort already installed from cache."
33-
fi
34-
- name: cargo sort
35-
run: cargo sort --check
36-
- name: Build
37-
run: cargo build --features "serde"
38-
- name: Run tests
39-
run: cargo test -- --test-threads=1
40-
- name: fmt
41-
run: cargo fmt -v -- --check
42-
- name: lint
43-
run: cargo clippy --tests -- -D clippy::all
44-
- name: doc
45-
run: cargo doc
12+
- uses: actions/checkout@v4
13+
- name: Cache cargo build
14+
uses: actions/cache@v4
15+
with:
16+
path: |
17+
~/.cargo/registry
18+
~/.cargo/git
19+
target
20+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/*.rs', '**/Cargo.toml') }}
21+
- name: Cache cargo binaries
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.cargo/bin
25+
key: cargo-bin-${{ runner.os }}-v1
26+
- name: Install cargo-sort if needed
27+
run: |
28+
if ! command -v cargo-sort &> /dev/null; then
29+
echo "Installing cargo-sort..."
30+
cargo install cargo-sort
31+
else
32+
echo "cargo-sort already installed from cache."
33+
fi
34+
- name: cargo sort
35+
run: cargo sort --check
36+
- name: Build
37+
run: cargo build --features "serde"
38+
- name: Run tests
39+
run: cargo test -- --test-threads=1
40+
- name: fmt
41+
run: cargo fmt -v -- --check
42+
- name: lint
43+
run: cargo clippy --tests -- -D clippy::all
44+
- name: doc
45+
run: cargo doc

0 commit comments

Comments
 (0)