Skip to content

Commit 72e2f89

Browse files
committed
use caching on windows too
1 parent 6f6e25b commit 72e2f89

File tree

3 files changed

+58
-22
lines changed

3 files changed

+58
-22
lines changed

.github/workflows/rust.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,33 @@ jobs:
100100
with:
101101
path: /tmp/logs
102102
name: tests-trace-${{ matrix.cgroups }}-${{ matrix.os }}
103-
103+
tests-windows-build:
104+
runs-on: 'windows-2019'
105+
steps:
106+
- uses: actions/checkout@v2
107+
- uses: actions-rs/toolchain@v1.0.6
108+
with:
109+
# nightly is used for cargo --out-dir option.
110+
toolchain: nightly
111+
override: true
112+
- name: Install targets
113+
run: |
114+
rustup target add x86_64-pc-windows-gnu
115+
rustup target add x86_64-pc-windows-msvc
116+
- uses: actions/cache@v2
117+
with:
118+
path: ./target
119+
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
120+
- name: Build tests (musl)
121+
run: |
122+
powershell ci/windows-builds.ps1
123+
timeout-minutes: 5
124+
- uses: actions/upload-artifact@v2
125+
with:
126+
path: ./tests
127+
name: tests-windows
128+
retention-days: 2
129+
104130
tests-windows:
105131
strategy:
106132
matrix:
@@ -110,10 +136,10 @@ jobs:
110136
runs-on: windows-latest
111137
steps:
112138
- uses: actions/checkout@v2
113-
- uses: actions-rs/toolchain@v1.0.6
114-
with:
115-
toolchain: stable
116-
override: true
139+
- uses: actions/download-artifact@v1
140+
with:
141+
path: ./tests
142+
name: tests-windows
117143
- name: Test
118144
run: powershell ci/windows.ps1
119145
timeout-minutes: 5

ci/windows-build.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
4+
function Build-JJSForTarget {
5+
param($TargetName)
6+
7+
New-Item -ItemType directory -Path ./tests/$TargetName
8+
cargo build -p minion-tests -Zunstable-options --out-dir=./tests/$TargetName --target=$TargetName
9+
10+
if ($LASTEXITCODE -ne 0) {
11+
throw "build failure"
12+
}
13+
}
14+
15+
Write-Output @'
16+
[build]
17+
rustflags=["--cfg", "minion_ci"]
18+
'@ | Out-File -FilePath ./.cargo/config -Encoding 'utf8'
19+
20+
21+
22+
$env:RUSTC_BOOTSTRAP = 1
23+
Build-JJSForTarget -TargetName x86_64-pc-windows-gnu
24+
Build-JJSForTarget -TargetName x86_64-pc-windows-msvc

ci/windows.ps1

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,10 @@ $ErrorActionPreference = "Stop"
22

33
Write-Output "::group::Info"
44
Write-Output "Target: $env:CI_TARGET"
5-
Write-Output "::group::Preparing"
6-
rustup target add $env:CI_TARGET
7-
Write-Output @'
8-
[build]
9-
rustflags=["--cfg", "minion_ci"]
10-
'@ | Out-File -FilePath ./.cargo/config -Encoding 'utf8'
11-
12-
Write-Output "::group::Compiling tests"
13-
$env:RUSTC_BOOTSTRAP = 1
14-
cargo build -p minion-tests -Zunstable-options --out-dir=./out --target=$env:CI_TARGET
15-
16-
if ($LASTEXITCODE -ne 0) {
17-
throw "build failure"
18-
}
19-
205
Write-Output "::group::Running tests"
21-
$env:RUST_BACKTRACE = 1
22-
./out/minion-tests.exe --trace
6+
7+
$env:RUST_BACKTRACE = full
8+
./tests/$env:CI_TARGET/minion-tests.exe --trace
239
if ($LASTEXITCODE -ne 0) {
2410
throw "tests failed"
2511
}

0 commit comments

Comments
 (0)