Skip to content

Commit 90ca8eb

Browse files
authored
Bump version to 0.5.0, update dependencies, and pin Rust 1.91 in CI (#12)
* Bump version to 0.5.0, update dependencies, and pin Rust 1.91 in CI - Update all crate dependencies to latest compatible versions (46 packages) - Sync package version to 0.5.0 across Cargo.toml, VERSION, and Helm charts - Pin CI workflow to Rust 1.91 for consistent builds * Improve CI workflow with separate lint/test/build jobs - Split monolithic build job into lint, test, and build stages - Add pull_request trigger for PR validation - Docker push only on main branch (DO_PUSH condition) - Use GitHub Actions cache (type=gha) for non-main builds - Add explicit permissions (contents: read) - Improve clippy check with --all-targets flag - Include Rust version in cache key for consistency * Sync lint commands and fix clippy warnings - Split Makefile lint into lint (check) and lint_fix (auto-fix) - Update dev_check to use lint_fix for convenience - CI workflow now uses make lint for consistency - Fix collapsible_if warnings using let chains (Rust 2024) - Fix bool_assert_comparison: use assert!(!expr) instead of assert_eq!(expr, false) - Fix assertions_on_constants: remove useless assert!(true) - Fix len_zero: use !is_empty() instead of len() >= 1
1 parent 44cab02 commit 90ca8eb

File tree

11 files changed

+184
-135
lines changed

11 files changed

+184
-135
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,64 @@
11
name: Lint & test & build
22

3-
on: push
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
env:
11+
DO_PUSH: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
412

513
jobs:
6-
build:
14+
lint:
715
runs-on: ubuntu-latest
8-
916
steps:
1017
- uses: actions/checkout@v4
1118

1219
- name: Set up Rust
13-
uses: dtolnay/rust-toolchain@stable
20+
uses: dtolnay/rust-toolchain@1.91
1421
with:
1522
components: rustfmt, clippy
1623

24+
- name: Check formatting
25+
run: cargo fmt --all -- --check
26+
27+
- name: Run Clippy
28+
run: make lint
29+
30+
test:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Rust
36+
uses: dtolnay/rust-toolchain@1.91
37+
1738
- name: Cache cargo dependencies
1839
uses: actions/cache@v4
1940
with:
2041
path: |
2142
~/.cargo/registry
2243
~/.cargo/git
2344
target
24-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
45+
key: ${{ runner.os }}-rust-1.91-${{ hashFiles('**/Cargo.lock') }}
2546

26-
- name: Run CI pipeline
27-
run: make ci
47+
- name: Run tests
48+
run: cargo test -- --test-threads=1
49+
50+
build:
51+
needs: [lint, test]
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
2855

2956
- name: Get version
3057
id: version
3158
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
3259

3360
- name: Login to Docker Hub
61+
if: ${{ env.DO_PUSH == 'true' }}
3462
uses: docker/login-action@v3
3563
with:
3664
username: ${{ secrets.DOCKER_HUB_USERNAME }}
@@ -39,8 +67,19 @@ jobs:
3967
- name: Set up Docker Buildx
4068
uses: docker/setup-buildx-action@v3
4169

42-
- name: Build and push Docker image
43-
id: docker_build
70+
- name: Build Docker image (PR/branch)
71+
if: ${{ env.DO_PUSH == 'false' }}
72+
uses: docker/build-push-action@v6
73+
with:
74+
context: .
75+
file: Dockerfile
76+
push: false
77+
tags: logfowd2:${{ steps.version.outputs.VERSION }}
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max
80+
81+
- name: Build and push Docker image (main)
82+
if: ${{ env.DO_PUSH == 'true' }}
4483
uses: docker/build-push-action@v6
4584
with:
4685
context: .
@@ -51,6 +90,3 @@ jobs:
5190
${{ secrets.DOCKER_HUB_USERNAME }}/logfowd2:latest
5291
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/logfowd2:latest
5392
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/logfowd2:latest,mode=max
54-
55-
- name: Image digest
56-
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)