Skip to content

Commit 03220cf

Browse files
committed
Try out custom action
1 parent aea578c commit 03220cf

File tree

2 files changed

+7
-210
lines changed

2 files changed

+7
-210
lines changed

.github/workflows/rust-audit.yml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
name: Rust Vulnerability Audit
22

3-
env:
4-
CARGO_TERM_COLOR: always
5-
CARGO_TERM_UNICODE: true
6-
RUSTUP_TERM_COLOR: always
7-
RUSTC_BOOTSTRAP: 1
8-
RUST_BACKTRACE: 1
9-
103
on:
114
push:
125
paths:
@@ -17,36 +10,10 @@ on:
1710
workflow_dispatch:
1811

1912
jobs:
20-
lint:
13+
audit:
2114
runs-on: ubuntu-latest
2215
steps:
2316
- uses: actions/checkout@v4
24-
- name: Setup development environment
25-
run: |
26-
sudo apt update
27-
sudo apt install clang lld {libc,openssl}-dev
28-
29-
cat <<EOF >>"${GITHUB_ENV}"
30-
CC=clang
31-
LD=ld.lld
32-
EOF
33-
34-
mkdir -p .cargo
35-
cat >~/.cargo/config.toml <<EOF
36-
[build]
37-
rustflags = [
38-
"-C", "linker=clang",
39-
"-C", "link-arg=-fuse-ld=lld"
40-
]
41-
EOF
42-
- name: Install Rust toolchain
43-
run: |
44-
rustup set profile minimal
45-
rustup set auto-self-update disable
46-
rustup toolchain install stable
47-
- name: Set up Rust cache
48-
uses: Swatinem/rust-cache@v2
49-
with:
50-
shared-key: "global"
17+
- uses: illdefined/rust@main
5118
- run: cargo install --locked cargo-audit
5219
- run: cargo audit

.github/workflows/rust-check.yml

Lines changed: 5 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,19 @@ on:
55
- pull_request
66
- workflow_dispatch
77

8-
env:
9-
CARGO_TERM_COLOR: always
10-
CARGO_TERM_UNICODE: true
11-
RUSTUP_TERM_COLOR: always
12-
RUSTC_BOOTSTRAP: 1
13-
RUST_BACKTRACE: 1
14-
158
jobs:
169
lint:
1710
name: Clippy Lint
1811
runs-on: ubuntu-latest
1912
steps:
2013
- uses: actions/checkout@v4
21-
- name: Set up development environment
22-
run: |
23-
sudo apt update
24-
sudo apt install clang lld {libclang-rt,libc,libssl}-dev
25-
26-
cat <<EOF >>"${GITHUB_ENV}"
27-
CC=clang
28-
LD=ld.lld
29-
EOF
30-
- name: Install Rust toolchain
31-
run: |
32-
rustup set profile minimal
33-
rustup set auto-self-update disable
34-
rustup toolchain install stable
35-
rustup component add clippy
36-
37-
mkdir -p ~/.cargo
38-
cat >~/.cargo/config.toml <<EOF
39-
[build]
40-
rustflags = [
41-
"-C", "linker=clang",
42-
"-C", "link-arg=--rtlib=compiler-rt",
43-
"-C", "link-arg=-fuse-ld=lld"
44-
]
45-
EOF
46-
- name: Set up Rust cache
47-
uses: Swatinem/rust-cache@v2
14+
- uses: illdefined/rust@main
4815
with:
49-
shared-key: "global"
16+
components: clippy
5017
- run: cargo clippy --all-targets --all-features
5118

52-
check-native:
53-
name: Check ${{ runner.os }} ${{ runner.arch }}
19+
check:
20+
name: Rust Check
5421
strategy:
5522
matrix:
5623
system:
@@ -63,143 +30,6 @@ jobs:
6330
runs-on: ${{ matrix.system }}
6431
steps:
6532
- uses: actions/checkout@v4
66-
- name: Set up development environment (Linux)
67-
run: |
68-
sudo apt update
69-
sudo apt install clang lld {libclang-rt,libc,musl,libssl}-dev
70-
71-
cat <<EOF >>"${GITHUB_ENV}"
72-
CC=clang
73-
LD=ld.lld
74-
EOF
75-
76-
mkdir -p ~/.cargo
77-
cat >~/.cargo/config.toml <<EOF
78-
[build]
79-
rustflags = [
80-
"-C", "linker=clang",
81-
"-C", "link-arg=--rtlib=compiler-rt",
82-
"-C", "link-arg=-fuse-ld=lld"
83-
]
84-
EOF
85-
if: ${{ runner.os == 'Linux' }}
86-
- name: Set up development environment (macOS)
87-
run: |
88-
brew update
89-
brew install llvm lld openssl
90-
91-
cat <<EOF >>"${GITHUB_ENV}"
92-
CC=$(brew --prefix llvm)/bin/clang
93-
LD=$(brew --prefix lld)/bin/ld64.lld
94-
EOF
95-
96-
mkdir -p .cargo
97-
cat >~/.cargo/config.toml <<EOF
98-
[build]
99-
rustflags = [
100-
"-C", "linker=$(brew --prefix llvm)/bin/clang",
101-
"-C", "link-arg=--rtlib=compiler-rt",
102-
"-C", "link-arg=-fuse-ld=lld"
103-
]
104-
EOF
105-
if: ${{ runner.os == 'macOS' }}
106-
- name: Set up development environment (Windows)
107-
run: |
108-
choco install openssl
109-
if: ${{ runner.os == 'Windows' }}
110-
- name: Set up Rust toolchain
111-
run: |
112-
rustup set profile minimal
113-
rustup set auto-self-update disable
114-
rustup toolchain install stable
115-
- name: Configure Rust targets (Linux x86-64)
116-
run: |
117-
rustup target add x86_64-unknown-linux-gnu x86_64-unknown-linux-musl
118-
cat >>~/.cargo/config.toml <<EOF
119-
target = [
120-
"x86_64-unknown-linux-gnu",
121-
"x86_64-unknown-linux-musl"
122-
]
123-
EOF
124-
if: ${{ runner.os == 'Linux' && runner.arch == 'X64' }}
125-
- name: Configure Rust targets (Linux Arch64)
126-
run: |
127-
rustup target add aarch64-unknown-linux-gnu aarch64-unknown-linux-musl
128-
cat >>~/.cargo/config.toml <<EOF
129-
target = [
130-
"aarch64-unknown-linux-gnu",
131-
"aarch64-unknown-linux-musl"
132-
]
133-
EOF
134-
if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
135-
- name: Configure Rust targets (Windows x86-64)
136-
run: |
137-
rustup target add x86_64-pc-windows-gnu x86_64-pc-windows-msvc
138-
@"
139-
[build]
140-
target = [
141-
"x86_64-pc-windows-gnu",
142-
"x86_64-pc-windows-msvc"
143-
]
144-
"@ >>~/.cargo/config.toml
145-
if: ${{ runner.os == 'Windows' && runner.arch == 'X64' }}
146-
- name: Set up Rust cache
147-
uses: Swatinem/rust-cache@v2
148-
with:
149-
shared-key: "global"
150-
- run: cargo check
151-
- run: cargo test
152-
153-
check-riscv:
154-
name: Check Linux RISC-V
155-
runs-on: ubuntu-latest
156-
steps:
157-
- uses: actions/checkout@v4
158-
- name: Set up development environment
159-
run: |
160-
release="$(lsb_release --short --codename)"
161-
162-
sudo tee /etc/apt/sources.list.d/ubuntu.sources <<EOF
163-
Types: deb
164-
URIs: http://azure.archive.ubuntu.com/ubuntu/
165-
Suites: ${release} ${release}-updates ${release}-security
166-
Components: main restricted universe
167-
Architectures: amd64
168-
169-
Types: deb
170-
URIs: http://azure.ports.ubuntu.com/ubuntu-ports/
171-
Suites: ${release} ${release}-updates ${release}-security
172-
Components: main restricted universe
173-
Architectures: arm64 riscv64
174-
EOF
175-
176-
sudo dpkg --add-architecture riscv64
177-
178-
sudo apt update
179-
sudo apt install gcc-riscv64-linux-gnu qemu-user-binfmt {libc,libssl}-dev:riscv64
180-
181-
cat <<EOF >>"${GITHUB_ENV}"
182-
CC=riscv64-linux-gnu-gcc
183-
LD=riscv64-linux-gnu-ld
184-
EOF
185-
- name: Install Rust toolchain
186-
run: |
187-
rustup set profile minimal
188-
rustup set auto-self-update disable
189-
rustup toolchain install stable
190-
rustup target add riscv64gc-unknown-linux-gnu
191-
192-
mkdir -p .cargo
193-
cat >~/.cargo/config.toml <<EOF
194-
[build]
195-
target = [ "riscv64gc-unknown-linux-gnu" ]
196-
197-
[target.riscv64gc-unknown-linux-gnu]
198-
rustflags = [ "-C", "linker=riscv64-linux-gnu-gcc" ]
199-
EOF
200-
- name: Set up Rust cache
201-
uses: Swatinem/rust-cache@v2
202-
with:
203-
shared-key: "global"
33+
- uses: illdefined/rust@main
20434
- run: cargo check
20535
- run: cargo test

0 commit comments

Comments
 (0)