-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (140 loc) · 4.45 KB
/
release.yml
File metadata and controls
168 lines (140 loc) · 4.45 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
157
158
159
160
161
162
163
164
165
166
167
168
name: Release And Extended CI
on:
push:
branches: [main, develop]
tags:
- "v*"
workflow_dispatch:
schedule:
- cron: "0 6 * * 1"
concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
test-matrix:
name: Test Suite (${{ matrix.os }}, ${{ matrix.rust }})
if: github.event_name != 'schedule'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust: stable
- os: windows-latest
rust: stable
- os: macos-latest
rust: stable
- os: ubuntu-latest
rust: beta
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.os }}-${{ matrix.rust }}
- name: Run tests
run: cargo test --all-features --verbose
- name: Run doc tests
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'
run: cargo test --doc --all-features --verbose
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Cache advisory database
uses: actions/cache@v4
with:
path: ~/.cargo/advisory-db
key: ${{ runner.os }}-advisory-db
- name: Run security audit
run: cargo audit
coverage:
name: Code Coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Generate coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
flags: rust
name: rust-coverage
build-release:
name: Build Release (${{ matrix.target }})
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-matrix, security]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.os }}-${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --verbose
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: janus-${{ matrix.target }}
path: target/${{ matrix.target }}/release/janus${{ matrix.os == 'windows-latest' && '.exe' || '' }}
publish:
name: Publish to crates.io
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [test-matrix, security, build-release]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}