Skip to content

Commit 2a82984

Browse files
committed
ci: add zizmor check
1 parent 728cc61 commit 2a82984

6 files changed

Lines changed: 101 additions & 53 deletions

File tree

.github/workflows/benchmarks.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Benchmarks
33

44
on:
55
push:
6-
branches: [main]
6+
branches: [ main ]
77
workflow_dispatch:
88

9+
910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1112
cancel-in-progress: ${{ github.ref_name != 'main' }}
@@ -17,18 +18,20 @@ env:
1718
RUST_BACKTRACE: 1
1819
RUSTFLAGS: "-Dwarnings -C debuginfo=0"
1920

20-
jobs:
21+
jobs:
2122
bench:
2223
name: Benchmark
2324
runs-on: ubuntu-latest
2425
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v4
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
persist-credentials: false
2730

28-
- name: Install Rust toolchain
29-
uses: moonrepo/setup-rust@v1
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Install Rust toolchain
32+
uses: moonrepo/setup-rust@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3235

33-
- name: Run benchmarks
34-
run: cargo bench --all-targets --all-features
36+
- name: Run benchmarks
37+
run: cargo bench --all-targets --all-features

.github/workflows/ci.yaml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: CI
33

44
on:
55
push:
6-
branches: [main]
6+
branches: [ main ]
77
pull_request:
88

9+
910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1112
cancel-in-progress: ${{ github.ref_name != 'main' }}
@@ -22,36 +23,40 @@ jobs:
2223
name: Code Quality
2324
runs-on: ubuntu-latest
2425
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v4
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
persist-credentials: false
2730

28-
- name: Install Rust toolchain
29-
uses: moonrepo/setup-rust@v1
30-
with:
31-
components: clippy,rustfmt
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Install Rust toolchain
32+
uses: moonrepo/setup-rust@v1
33+
with:
34+
components: clippy,rustfmt
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3437

35-
- name: Check formatting
36-
run: cargo fmt --all --check
38+
- name: Check formatting
39+
run: cargo fmt --all --check
3740

38-
- name: Run Clippy
39-
run: cargo clippy --all-targets --all-features
41+
- name: Run Clippy
42+
run: cargo clippy --all-targets --all-features
4043

4144
test:
4245
name: Test
4346
runs-on: ubuntu-latest
4447
steps:
45-
- name: Checkout code
46-
uses: actions/checkout@v4
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
with:
51+
persist-credentials: false
4752

48-
- name: Install Rust toolchain
49-
uses: moonrepo/setup-rust@v1
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Install Rust toolchain
54+
uses: moonrepo/setup-rust@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5257

53-
- name: Check
54-
run: cargo check --all-targets --all-features
58+
- name: Check
59+
run: cargo check --all-targets --all-features
5560

56-
- name: Run tests
57-
run: cargo test
61+
- name: Run tests
62+
run: cargo test

.github/workflows/release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636
run: cargo check --all-targets --all-features && cargo test
3737

3838
- name: Tag the version
39+
env:
40+
GIT_TAG: ${{ inputs.publish-tag }}
3941
run: |
40-
git tag "${{ inputs.publish-tag }}"
41-
git push origin "${{ inputs.publish-tag }}"
42+
git tag "${GIT_TAG}"
43+
git push origin "${GIT_TAG}"
4244
4345
- name: Generate a changelog
4446
uses: orhun/git-cliff-action@v4

.github/workflows/test-e2e.yaml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: E2E Tests
33
on:
44
workflow_dispatch:
55

6+
67
env:
78
CI: true
89
FORCE_COLOR: 1
@@ -11,22 +12,26 @@ jobs:
1112
e2e-tests:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
1619

17-
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v3
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
1922

20-
- name: Build and run E2E tests
21-
run: |
22-
docker build -t test-e2e . -f e2e/Dockerfile && docker run --rm test-e2e
23+
- name: Build and run E2E tests
24+
run: |
25+
docker build -t test-e2e . -f e2e/Dockerfile && docker run --rm test-e2e
2326
24-
- name: Report status
25-
if: always()
26-
run: |
27-
if [ ${{ job.status }} == 'success' ]; then
28-
echo "E2E tests passed successfully!"
29-
else
30-
echo "E2E tests failed!"
31-
exit 1
32-
fi
27+
- name: Report status
28+
if: always()
29+
env:
30+
JOB_STATUS: ${{ job.status }}
31+
run: |
32+
if [ "${JOB_STATUS}" == "success" ]; then
33+
echo "E2E tests passed successfully!"
34+
else
35+
echo "E2E tests failed!"
36+
exit 1
37+
fi

.github/workflows/zizmor.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Gh Actions lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- '.github/workflows/**'
8+
pull_request:
9+
paths:
10+
- '.github/workflows/**'
11+
12+
jobs:
13+
zizmor:
14+
name: zizmor latest via PyPI
15+
runs-on: ubuntu-latest
16+
permissions:
17+
security-events: write
18+
# required for workflows in private repositories
19+
contents: read
20+
actions: read
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
26+
27+
- name: Install the latest version of uv
28+
uses: astral-sh/setup-uv@v4
29+
30+
- name: Run zizmor
31+
run: uvx zizmor .
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

crates/client/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ impl GameClient {
215215
) {
216216
let (horizontal, vertical, cells) = extract_data(&decode_base64(&view.0));
217217
let action = instructions::right_hand_solver(horizontal, vertical);
218-
let is_win = instructions::check_win_condition(cells, action.clone());
219-
if let Err(e) = send_message(stream, &Message::Action(action)) {
218+
if let Err(e) = send_message(stream, &Message::Action(action.clone())) {
220219
logger.error(&format!("{} failed to send action: {}", thread_name, e));
221220
}
222221

222+
let is_win = instructions::check_win_condition(cells, action);
223223
if is_win {
224224
logger.info(&format!("{} has found the exit!", thread_name));
225225
}

0 commit comments

Comments
 (0)