Skip to content

Commit 5456e55

Browse files
author
xi xiao
committed
feat: set github actions into parallel jobs
1 parent fc13910 commit 5456e55

File tree

1 file changed

+60
-16
lines changed

1 file changed

+60
-16
lines changed

.github/workflows/pr-ci-merge-main.yml

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
code_quality_and_tests:
17-
name: Code Quality & Tests
16+
code_quality:
17+
name: Code Quality (fmt + clippy)
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout Code
@@ -47,32 +47,43 @@ jobs:
4747
with:
4848
components: clippy, rustfmt
4949

50-
- name: Code Quality Checks
50+
- name: Run fmt & clippy
5151
run: |
5252
cargo fmt -- --check
5353
cargo clippy --all-targets --all-features -- -D warnings
5454
55+
tests:
56+
name: Tests (with coverage)
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout Code
60+
uses: actions/checkout@v4
61+
62+
- name: Cache Rust Dependencies
63+
uses: actions/cache@v3
64+
with:
65+
path: |
66+
~/.cargo/registry
67+
~/.cargo/git
68+
target
69+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
70+
restore-keys: |
71+
${{ runner.os }}-cargo-
72+
73+
- name: Set up Rust
74+
uses: dtolnay/rust-toolchain@stable
75+
with:
76+
components: clippy, rustfmt
77+
5578
- name: Install cargo-tarpaulin
5679
uses: baptiste0928/cargo-install@v3
5780
with:
5881
crate: cargo-tarpaulin
5982

60-
- name: Run Tests
83+
- name: Run Tests with Coverage
6184
run: |
6285
cargo tarpaulin --out Xml --output-dir coverage.xml
6386
64-
- name: Run Battle Tests
65-
run: |
66-
chmod +x tests/battle_test/battle_testing.sh
67-
./tests/battle_test/battle_testing.sh
68-
69-
- name: Upload Format Error Logs
70-
if: failure()
71-
uses: actions/upload-artifact@v3
72-
with:
73-
name: format-error-logs
74-
path: tests/battle_test/format_errors.log
75-
7687
- name: Upload Coverage Report
7788
uses: actions/upload-artifact@v4
7889
with:
@@ -84,6 +95,39 @@ jobs:
8495
with:
8596
token: ${{ secrets.CODECOV_TOKEN }}
8697

98+
battle_test:
99+
name: Battle Tests
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Checkout Code
103+
uses: actions/checkout@v4
104+
105+
- name: Cache Rust Dependencies
106+
uses: actions/cache@v3
107+
with:
108+
path: |
109+
~/.cargo/registry
110+
~/.cargo/git
111+
target
112+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
113+
restore-keys: |
114+
${{ runner.os }}-cargo-
115+
116+
- name: Set up Rust
117+
uses: dtolnay/rust-toolchain@stable
118+
119+
- name: Run Battle Tests
120+
run: |
121+
chmod +x tests/battle_test/battle_testing.sh
122+
./tests/battle_test/battle_testing.sh
123+
124+
- name: Upload Battle Test Logs
125+
if: failure()
126+
uses: actions/upload-artifact@v3
127+
with:
128+
name: format-error-logs
129+
path: tests/battle_test/format_errors.log
130+
87131
audit:
88132
name: Security Audit
89133
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)