Skip to content

Commit 8e84c2e

Browse files
committed
ci: resolve target tuple from rustc
1 parent 30024f8 commit 8e84c2e

File tree

1 file changed

+14
-38
lines changed

1 file changed

+14
-38
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ jobs:
1717
name: Test
1818
strategy:
1919
matrix:
20-
include:
21-
- os: ubuntu-24.04
22-
target: x86_64-unknown-linux-gnu
23-
- os: windows-2022
24-
target: x86_64-pc-windows-msvc
25-
- os: macOS-latest
26-
target: aarch64-apple-darwin
20+
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
2721
runs-on: ${{ matrix.os }}
2822
env:
2923
RUSTUP_UNPACK_RAM: "26214400"
@@ -38,13 +32,14 @@ jobs:
3832
- if: ${{ runner.os == 'Linux' }}
3933
name: Linux - Install native dependencies
4034
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
41-
# cargo version is a random command that forces the installation of rust-toolchain
35+
# just need a random command that forces the installation of rust-toolchain
36+
# figure out native target triple while we're at it
4237
- name: install rust-toolchain
43-
run: cargo version
38+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
4439
# Fetch dependencies in a separate step to clearly show how long each part
4540
# of the testing takes
4641
- name: cargo fetch --locked
47-
run: cargo fetch --locked --target ${{ matrix.target }}
42+
run: cargo fetch --locked --target $TARGET
4843

4944
# Core crates
5045
# Compiled in --release because cargo compiletest would otherwise compile in release again.
@@ -80,10 +75,8 @@ jobs:
8075
name: Android
8176
strategy:
8277
matrix:
83-
include:
84-
- os: ubuntu-24.04
85-
target: aarch64-linux-android
86-
host: x86_64-unknown-linux-gnu
78+
os: [ ubuntu-24.04 ]
79+
target: [ aarch64-linux-android ]
8780
runs-on: ${{ matrix.os }}
8881
env:
8982
RUSTUP_UNPACK_RAM: "26214400"
@@ -95,11 +88,8 @@ jobs:
9588
with:
9689
version: 1.4.309.0
9790
cache: true
98-
# cargo version is a random command that forces the installation of rust-toolchain
9991
- name: install rust-toolchain
10092
run: cargo version
101-
# Fetch dependencies in a separate step to clearly show how long each part
102-
# of the testing takes
10393
- name: cargo fetch --locked
10494
run: cargo fetch --locked --target ${{ matrix.target }}
10595

@@ -130,13 +120,7 @@ jobs:
130120
name: Compiletest
131121
strategy:
132122
matrix:
133-
include:
134-
- os: ubuntu-24.04
135-
target: x86_64-unknown-linux-gnu
136-
- os: windows-2022
137-
target: x86_64-pc-windows-msvc
138-
- os: macOS-latest
139-
target: aarch64-apple-darwin
123+
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
140124
runs-on: ${{ matrix.os }}
141125
steps:
142126
- uses: actions/checkout@v4
@@ -145,25 +129,18 @@ jobs:
145129
with:
146130
version: 1.4.309.0
147131
cache: true
148-
# cargo version is a random command that forces the installation of rust-toolchain
149132
- name: install rust-toolchain
150-
run: cargo version
133+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
151134
- name: cargo fetch --locked
152-
run: cargo fetch --locked --target ${{ matrix.target }}
135+
run: cargo fetch --locked --target $TARGET
153136
- name: compiletest
154137
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.1,vulkan1.2,spv1.3
155138

156139
difftest:
157140
name: Difftest
158141
strategy:
159142
matrix:
160-
include:
161-
- os: ubuntu-24.04
162-
target: x86_64-unknown-linux-gnu
163-
- os: windows-2022
164-
target: x86_64-pc-windows-msvc
165-
- os: macOS-latest
166-
target: aarch64-apple-darwin
143+
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
167144
runs-on: ${{ matrix.os }}
168145
steps:
169146
- uses: actions/checkout@v4
@@ -182,13 +159,12 @@ jobs:
182159
sudo add-apt-repository ppa:kisak/turtle -y
183160
sudo apt-get update
184161
sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
185-
# cargo version is a random command that forces the installation of rust-toolchain
186162
- name: install rust-toolchain
187-
run: cargo version
163+
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
188164
- name: cargo fetch --locked
189-
run: cargo fetch --locked --target ${{ matrix.target }}
165+
run: cargo fetch --locked --target $TARGET
190166
- name: cargo fetch --locked difftests
191-
run: cargo fetch --locked --manifest-path=tests/difftests/tests/Cargo.toml --target ${{ matrix.target }}
167+
run: cargo fetch --locked --manifest-path=tests/difftests/tests/Cargo.toml --target $TARGET
192168
- name: test difftest
193169
run: cargo test -p "difftest*" --release --no-default-features --features "use-installed-tools"
194170
- name: difftests

0 commit comments

Comments
 (0)