-
-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (92 loc) · 3.04 KB
/
pull-request.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
84
85
86
87
88
89
90
91
92
name: Pull Request
on:
pull_request:
types: [opened, edited, synchronize]
paths-ignore:
- LICENSE.md
- .gitignore
- Justfile
jobs:
format:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Rust Toolchain
uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f # v1
with:
components: rustfmt
- name: Check Formatting
run: cargo fmt -- --check
lint:
name: Lint Source
runs-on: ubuntu-latest
strategy:
matrix:
features:
- name: Default
args: ''
- name: No Standard
args: --no-default-features
- name: All Features
args: --all-features
- name: Report
args: --features report
- name: Unstable
args: --features unstable
- name: Nightly
args: --features nightly
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Rust Toolchain
uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f # v1
with:
components: clippy
- name: Clippy
uses: giraffate/clippy-action@13b9d32482f25d29ead141b79e7e04e7900281e0 # v1
test:
name: Test Suite
runs-on: ${{matrix.os}}-latest
needs: [lint, format]
defaults:
run:
shell: bash
strategy:
matrix:
toolchain: [stable, beta, nightly]
profile: [release, dev]
# One day we'll be able to just use `--profile`, but until then we need
# to do this workaround to simplify the build steps
os: [ubuntu, windows, macos]
env:
SCCACHE_CACHE_SIZE: 5G
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Authenticate GitHub CLI
run: echo ${{github.token}} | gh auth login --with-token
- name: Setup Rust Toolchain
uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f # v1
with:
bins: sccache, cargo-hack
channel: ${{matrix.toolchain}}
cache-target: ${{matrix.profile}}
- name: Setup Shared Cache Directory
run: |
declare path="${HOME}/.cache/sccache"
if test "${RUNNER_OS}" = "Windows"; then
path=$(cygpath --windows "${path}")
fi
echo "SCCACHE_DIR=${path}" >> "${GITHUB_ENV}"
- name: Restore sccache build artifacts
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with:
restore-keys: ${{runner.os}}-${{matrix.toolchain}}-${{matrix.profile}}-
key: ${{runner.os}}-${{matrix.toolchain}}-${{matrix.profile}}-${{hashFiles('**/Cargo.lock')}}
path: ${{env.SCCACHE_DIR}}
- name: Run Tests (${{matrix.profile}})
run: cargo hack test --profile ${{matrix.profile}} --feature-powerset
env:
RUSTC_WRAPPER: sccache