-
Notifications
You must be signed in to change notification settings - Fork 4
159 lines (137 loc) · 4.92 KB
/
test.yml
File metadata and controls
159 lines (137 loc) · 4.92 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: 'Test'
on:
pull_request:
branches: [ "master" ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
code-quality:
name: "Code Quality"
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-11-29 # Hardcoded version, same as is in the build.rs
- name: 'Build stable-mir-json' # rustfmt documentation claims it is unstable on code that doesn't build
run: |
cargo build -vv
- name: "Check `cargo clippy`"
run: |
rustup component add clippy
cargo clippy -- -Dwarnings
- name: "Check `cargo fmt`"
run: |
rustup component add rustfmt
cargo fmt --check
- name: 'Install Nix'
uses: cachix/install-nix-action@v31.5.1
with:
install_url: https://releases.nixos.org/nix/nix-2.30.1/install
extra_nix_config: |
substituters = https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: "Check `nixfmt`"
run: |
NIX_FILES=$(bash -O globstar -c 'ls **/*.nix')
nix shell nixpkgs#nixfmt-rfc-style --command nixfmt --check ${NIX_FILES}
integration-tests:
needs: code-quality
name: "Integration tests"
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-11-29 # Hardcoded version, same as is in the build.rs
- name: 'Build stable-mir-json'
run: | # Warning check should be redundant since code-quality runs first
RUSTFLAGS='--deny warnings' cargo build -vv
- name: 'Install a good-enough jq version'
uses: dcarbone/install-jq-action@v3
with:
version: 1.7.1
force: true
- name: 'Run smir integration tests'
run: |
which jq
jq --version
make integration-test
ui-tests:
needs: code-quality
name: "ui-tests"
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: 'Check out Rust repo'
uses: actions/checkout@v4
with:
repository: rust-lang/rust
ref: a2545fd6fc66b4323f555223a860c451885d1d2b # hash of Hardcoded Rust version
path: rust
fetch-depth: 1
- name: "Set up nightly Rust" # https://github.com/rust-lang/rustup/issues/3409
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-11-29 # Hardcoded version, same as is in the build.rs
- name: 'Build stable-mir-json'
run: | # Warning check should be redundant since code-quality runs first
RUSTFLAGS='--deny warnings' cargo build -vv
- name: 'Run smir integration tests'
run: |
RUST_DIR_ROOT='rust' VERBOSE=1 make test-ui
nix:
needs: code-quality
name: 'Nix Tests'
strategy:
fail-fast: false
matrix:
runner: [normal, MacM1] # MacM1 / normal are self-hosted,
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
steps:
- name: 'Check out code'
uses: actions/checkout@v4
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: 'Install Nix'
if: ${{ matrix.runner != 'MacM1' }}
uses: cachix/install-nix-action@v31.5.1
with:
install_url: https://releases.nixos.org/nix/nix-2.30.1/install
extra_nix_config: |
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org
- name: 'Install Cachix'
if: ${{ matrix.runner != 'MacM1' }}
uses: cachix/cachix-action@v16
with:
name: k-framework
- name: 'Build and test'
run: |
set -euxo pipefail
nix --version
nix flake check # build and run integration & unit tests