Skip to content

Commit c28ba2d

Browse files
committed
feat: add CI workflows for Rust linting, building, testing, and release automation
1 parent f646fc8 commit c28ba2d

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on:
2+
push:
3+
branches: [ main ]
4+
tags: [ 'v*' ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
lint-build-test:
10+
name: Lint, Build, Test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rust
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
components: rustfmt, clippy
20+
override: true
21+
22+
- name: Check Formatting
23+
run: cargo fmt --all -- --check
24+
25+
- name: Build
26+
run: cargo build --all-features
27+
28+
- name: Run Tests
29+
run: cargo test --all-features
30+
31+
- name: Run clippy
32+
uses: actions-rs/clippy-check@v1
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
args: --all-features
36+
37+
release:
38+
name: Create Release
39+
if: startsWith(github.ref, 'refs/tags/v')
40+
runs-on: ubuntu-latest
41+
needs: lint-build-test
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Install Rust
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
profile: minimal
49+
toolchain: stable
50+
override: true
51+
52+
- name: Build Release
53+
run: cargo build --release
54+
55+
- name: Create GitHub Release
56+
uses: softprops/action-gh-release@v1
57+
with:
58+
tag_name: ${{ github.ref_name }}
59+
name: Release ${{ github.ref_name }}
60+
body: |
61+
Automated release for version ${{ github.ref_name }}
62+
files: |
63+
target/release/uri2json
64+
overwrite: true
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/rust-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint, Build, Test
2+
3+
on:
4+
push:
5+
branches:
6+
-"*"
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
lint-build-test:
13+
name: Lint, Build, Test
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
components: rustfmt, clippy
23+
override: true
24+
25+
- name: Check Formatting
26+
run: cargo fmt --all -- --check
27+
28+
- name: Build
29+
run: cargo build --all-features
30+
31+
- name: Run Tests
32+
run: cargo test --all-features
33+
34+
- name: Run clippy
35+
uses: actions-rs/clippy-check@v1
36+
with:
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
args: --all-features

0 commit comments

Comments
 (0)