-
Notifications
You must be signed in to change notification settings - Fork 7
70 lines (55 loc) · 1.52 KB
/
ci.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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build project
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-2022
- windows-2019
toolchain:
- stable
- nightly
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Setup ${{ matrix.toolchain }} toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- name: Patch MSVC linker
run: |
cargo install anonlink
anonlink
- name: Cargo build
run: cargo build --release
- name: Cargo clippy
run: cargo clippy --release -- -D warnings
- name: Cargo fmt
run: cargo fmt -- --check
- name: Test execution
run: |
$target = Get-Location
$job = Start-Job -ScriptBlock {
param ($target)
& "${target}\target\release\min-sized-rust-windows.exe"
} -ArgumentList $target
$state = Wait-Job $job -Timeout 10
$out = Receive-Job $job
if ($out -ne "Hello World!") {
Throw "Output did not equal ``Hello World!``, got ``$out``."
}
- name: Get size
run: (Get-Item ".\target\release\min-sized-rust-windows.exe").Length