Skip to content

Commit 39334ea

Browse files
authored
Merge pull request #1 from ewels/add-ci-cd-workflows
2 parents 112f485 + b304b63 commit 39334ea

11 files changed

Lines changed: 747 additions & 8 deletions

File tree

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
target/
2+
.git/
3+
.github/
4+
test/
5+
tests/
6+
docs/
7+
*.md
8+
LICENSE
9+
.gitignore
10+
.dockerignore

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "cargo"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
# Override the [profile.release] settings from Cargo.toml for CI: fat-LTO +
18+
# codegen-units=1 are great for release binaries but ~10× slower to compile
19+
# than thin-LTO, which bites hard on every matrix leg. Release binaries in
20+
# release.yml unset these so they get the real profile.
21+
CARGO_PROFILE_RELEASE_LTO: "thin"
22+
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
23+
24+
jobs:
25+
test:
26+
name: Test (${{ matrix.name }})
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- name: linux-x86_64
33+
os: ubuntu-latest
34+
- name: linux-x86_64-v3
35+
os: ubuntu-latest
36+
target_cpu: x86-64-v3
37+
- name: linux-aarch64
38+
os: ubuntu-24.04-arm
39+
- name: macos-aarch64
40+
os: macos-latest
41+
- name: windows-x86_64
42+
os: windows-latest
43+
steps:
44+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
45+
46+
- name: Install Rust toolchain
47+
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # ratchet:dtolnay/rust-toolchain@stable
48+
49+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # ratchet:Swatinem/rust-cache@v2.9.1
50+
51+
- name: Detect host triple
52+
if: matrix.target_cpu
53+
shell: bash
54+
run: echo "HOST_TRIPLE=$(rustc -vV | awk '/^host:/ {print $2}')" >> "$GITHUB_ENV"
55+
56+
- name: Build
57+
shell: bash
58+
run: >
59+
cargo build --release
60+
${TARGET_CPU:+--target "$HOST_TRIPLE" --config "target.'$HOST_TRIPLE'.rustflags=['-C', 'target-cpu=$TARGET_CPU']"}
61+
env:
62+
TARGET_CPU: ${{ matrix.target_cpu || '' }}
63+
64+
- name: Test
65+
shell: bash
66+
run: >
67+
cargo test --release
68+
${TARGET_CPU:+--target "$HOST_TRIPLE" --config "target.'$HOST_TRIPLE'.rustflags=['-C', 'target-cpu=$TARGET_CPU']"}
69+
env:
70+
TARGET_CPU: ${{ matrix.target_cpu || '' }}
71+
72+
fmt:
73+
name: Formatting
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
77+
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # ratchet:dtolnay/rust-toolchain@stable
78+
with:
79+
components: rustfmt
80+
- run: cargo fmt --check
81+
82+
clippy:
83+
name: Clippy
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
87+
88+
- name: Install Rust toolchain
89+
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # ratchet:dtolnay/rust-toolchain@stable
90+
with:
91+
components: clippy
92+
93+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # ratchet:Swatinem/rust-cache@v2.9.1
94+
95+
- run: cargo clippy -- -D warnings
96+
97+
msrv:
98+
name: MSRV check
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
102+
103+
- name: Install Rust MSRV toolchain
104+
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # ratchet:dtolnay/rust-toolchain@master
105+
with:
106+
toolchain: "1.88"
107+
108+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # ratchet:Swatinem/rust-cache@v2.9.1
109+
110+
- name: Check MSRV compiles
111+
run: cargo check
112+
113+
audit:
114+
name: Security audit
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
118+
- uses: rustsec/audit-check@v2
119+
with:
120+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)