-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (49 loc) · 1.5 KB
/
qa-and-release.yml
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
name: Code QA & Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features
- name: Run Tests
run: cargo test --workspace --features=regex,crypto,base64,hmac,reqwest,multipart
- name: Run cargo fmt
if: github.event_name == 'push'
run: cargo fmt --all
- name: Commit fmt changes
if: github.event_name == 'push'
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
git add .
git commit -m "style(cargo-fmt): apply changes" || echo "No changes to commit"
- name: Push fmt changes
if: github.event_name == 'push' && success()
run: git push origin HEAD:${{ github.ref }}
release:
name: Release Package
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
- name: Publish package
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish