Repository navigation
125 lines (115 loc) · 3.82 KB
/
Copy pathci.yml
File metadata and controls
125 lines (115 loc) · 3.82 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
# https://github.com/actions-rs/example/blob/23ffb1bf0016f41999902ba7542b4f1bb1a89c48/.github/workflows/quickstart.yml#L4
name: CI
on:
push:
branches:
- main
# See:
# https://stackoverflow.com/questions/62968897/is-it-possible-to-not-run-github-action-for-readme-updates
# and
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-excluding-paths
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run cargo check
run: cargo check --locked
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run cargo test with backtrace
run: cargo test --locked -- --nocapture
env:
RUST_BACKTRACE: 1
lints:
name: Lints
runs-on: ubuntu-latest
env:
RUSTFLAGS: '-Dwarnings'
steps:
- name: Checkout sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy --locked --all-targets --all-features
build:
# dist builds releases on these runners, the ones its plan picks for the
# targets in dist-workspace.toml, but only when releasing. Prism is C, so
# each needs a C compiler.
name: Build (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-26
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
- target: x86_64-unknown-linux-musl
runner: ubuntu-22.04
- target: x86_64-pc-windows-msvc
runner: windows-2022
# dist links the C runtime statically, so cc builds Prism with /MT
rustflags: -Ctarget-feature=+crt-static
runs-on: ${{ matrix.runner }}
env:
TARGET: ${{ matrix.target }}
RUSTFLAGS: ${{ matrix.rustflags }}
steps:
- name: Checkout sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# As dist does for this target
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Run cargo build
shell: bash
run: |
rustup toolchain install
rustup target add "$TARGET"
cargo build --locked --profile dist --target "$TARGET"
# Only Test Suite runs Prism otherwise, and only on x86_64 Linux
- name: Run pks on a fixture
shell: bash
run: |
"target/$TARGET/dist/pks" --project-root tests/fixtures/simple_app \
--no-cache list-references | grep -F '"constant_name":"::Bar"'
build-all:
# The one check for the ruleset to require, since the matrix's names change
# with its targets. A skipped required check counts as passing, so this runs
# even when a build fails, and fails then.
name: Build
needs: build
if: always()
runs-on: ubuntu-latest
steps:
- name: Check that every target built
env:
RESULT: ${{ needs.build.result }}
run: test "$RESULT" = success