-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (67 loc) · 2.13 KB
/
test.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
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Test action
on:
# Runs when someone pushes to the main branch.
push:
branches: [main]
# Runs when someone updates a PR.
pull_request:
# Allow running manually.
workflow_dispatch:
jobs:
test:
name: Test action (${{ matrix.os }}, ${{ matrix.project-path }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
project-path: ['.', subdir]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Initialize Rust project
run: cargo init --bin --vcs=none ${{ matrix.project-path }}
- name: Build Rust project
working-directory: ${{ matrix.project-path }}
run: cargo build
- name: cargo-sweep
uses: ./
with:
manifest-path: ${{ matrix.project-path }}/Cargo.toml
- name: Check Rust project
working-directory: ${{ matrix.project-path }}
run: cargo check
# `cargo-sweep` should delete all build files, but keep the check ones.
ncc:
name: Verify `ncc` output is up-to-date
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ^9.7.1
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm build
- name: Error if files have changed
run: |
if [[ $(git status --porcelain) ]]; then
echo '::error title=Rebuilt Javascript bundles and found a different output.::Did you run `pnpm build`?'
# Force colorful output for these commands, since a human and not a machine is meant to
# read them.
git -c color.ui=always status
git -c color.ui=always diff
exit 1
else
echo Rebuilt Javascript bundles match.
fi