-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathaction.yml
More file actions
156 lines (146 loc) · 5.81 KB
/
action.yml
File metadata and controls
156 lines (146 loc) · 5.81 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
name: 'CI VM'
description: 'Run main CI steps in VMs for VM-only platforms.'
inputs:
working-directory:
description: 'Working directory.'
default: '.'
platform:
description: 'Platform to run the checks on.'
default: ''
codecov-token:
description: 'Codecov token, if Codecov upload is desired.'
default: ''
runs:
using: composite
steps:
- shell: bash
id: prep
env:
WD: ${{ inputs.working-directory }}
PLATFORM: ${{ inputs.platform }}
WORKSPACE: ${{ inputs.working-directory == '.' && '--workspace' || '' }}
run: |
cat <<EOF > prepare.sh
# This executes as root
set -ex
pwd
case "$PLATFORM" in
freebsd) pkg update -f && pkg install -y curl llvm nss pkgconf
;;
openbsd) # TODO: Is there a way to not pin the version of llvm? -z to pkg_add does not work.
pkg_add rust rust-clippy rust-rustfmt llvm-21.1.2p0 nss # rustup does not support OpenBSD at all
;;
netbsd) /usr/sbin/pkg_add pkgin && pkgin -y update && pkgin -y install curl clang nss pkgconf
;;
solaris) pkg refresh && pkg install clang-libs nss pkg-config
;;
*) echo "Unsupported OS: $PLATFORM"
exit 1
;;
esac
EOF
{
echo 'prepare<<EOF'
cat prepare.sh
echo EOF
} >> "$GITHUB_OUTPUT"
cat <<EOF > run.sh
# This executes as user
set -ex
cd "$WD"
pwd
case "$PLATFORM" in
openbsd) export LIBCLANG_PATH=/usr/local/llvm21/lib
export LLVM_COV=/usr/local/llvm21/bin/llvm-cov
export LLVM_PROFDATA=/usr/local/llvm21/bin/llvm-profdata
;;
*) sh rustup.sh --default-toolchain stable --profile minimal --component clippy,llvm-tools,rustfmt -y
. "\$HOME/.cargo/env"
;;
esac
case "$PLATFORM" in
netbsd) # FIXME: Why do we need to set this on NetBSD?
export LD_LIBRARY_PATH=/usr/pkg/lib/nss:/usr/pkg/lib/nspr
;;
solaris) export LIBCLANG_PATH="/usr/lib/amd64"
;;
esac
case "$PLATFORM" in
freebsd) ;;
*) [ "$WORKSPACE" ] && EXCLUDE="--exclude fuzz" # Fuzzing not supported on this platform
;;
esac
cargo version
cargo check --locked --all-targets $WORKSPACE \${EXCLUDE:-}
case "$PLATFORM" in
openbsd) # clippy fails on OpenBSD, because libfuzzer-sys is not supported.
;;
*) cargo clippy -- -D warnings
;;
esac
cargo fmt --all -- --check
case "$PLATFORM" in
freebsd) cargo install cargo-llvm-cov --locked
cargo llvm-cov test --locked --no-fail-fast --codecov --output-path codecov.json
;;
*) # FIXME: No profiler support on other platforms, error is: cannot find crate for profiler_builtins
cargo test --locked --no-fail-fast # We do this instead for now
;;
esac
cargo test --locked --no-fail-fast --release
rm -rf target # Do not sync this back to host
EOF
{
echo 'run<<EOF'
cat run.sh
echo EOF
} >> "$GITHUB_OUTPUT"
curl -o "$WD/rustup.sh" --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
echo "envs=CARGO_TERM_COLOR RUST_BACKTRACE RUST_LOG RUST_TEST_TIME_UNIT RUST_TEST_TIME_INTEGRATION RUST_TEST_TIME_DOCTEST WD" >> "$GITHUB_OUTPUT"
- if: ${{ inputs.platform == 'freebsd' }}
uses: vmactions/freebsd-vm@4807432c7cab1c3f97688665332c0b932062d31f # v1.4.3
with:
usesh: true
disable-cache: true
envs: ${{ steps.prep.outputs.envs }}
prepare: ${{ steps.prep.outputs.prepare }}
run: ${{ steps.prep.outputs.run }}
- if: ${{ inputs.platform == 'openbsd' }}
uses: vmactions/openbsd-vm@3fafb45f2e2e696249c583835939323fe1c3448c # v1.3.7
with:
usesh: true
disable-cache: true
envs: ${{ steps.prep.outputs.envs }}
prepare: ${{ steps.prep.outputs.prepare }}
run: ${{ steps.prep.outputs.run }}
- if: ${{ inputs.platform == 'netbsd' }}
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
with:
usesh: true
disable-cache: true
envs: ${{ steps.prep.outputs.envs }}
prepare: ${{ steps.prep.outputs.prepare }}
run: ${{ steps.prep.outputs.run }}
- if: ${{ inputs.platform == 'solaris' }}
uses: vmactions/solaris-vm@69d382b4a775b25ea5955e6c1730e9d05047ca0d # v1.3.1
with:
release: "11.4-gcc"
usesh: true
disable-cache: true
envs: ${{ steps.prep.outputs.envs }}
prepare: ${{ steps.prep.outputs.prepare }}
run: ${{ steps.prep.outputs.run }}
- id: check-coverage
shell: bash
env:
WORKING_DIR: ${{ inputs.working-directory }}
run: test -f "$WORKING_DIR/codecov.json" && echo "exists=true" >> "$GITHUB_OUTPUT" || true
- if: ${{ steps.check-coverage.outputs.exists == 'true' }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: codecov.json
working-directory: ${{ inputs.working-directory }}
fail_ci_if_error: false
token: ${{ inputs.codecov-token }}
verbose: true
flags: ${{ inputs.platform }}