Skip to content

Commit

Permalink
ci(rust): improve workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Jan 22, 2025
1 parent c17513c commit 760b8b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:
# Build regularly in order to have up to date base image in the edge image
schedule:
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
- cron: "42 2 * * 6" # weekly on Saturday 2:42 UTC

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Setup Rust
- uses: dtolnay/rust-toolchain@stable
id: rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: llvm-tools-preview

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- uses: taiki-e/install-action@cargo-llvm-cov

- uses: actions/checkout@v4
- run: cargo fetch
Expand All @@ -27,11 +21,9 @@ jobs:
key: coverage-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
path: target/

- name: Run cargo-llvm-cov
run: cargo llvm-cov --all-features --html
- run: cargo llvm-cov --html

- name: Upload Report
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/llvm-cov/html
20 changes: 6 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test and Build Rust
name: Rust

on:
push:
Expand All @@ -16,7 +16,6 @@ jobs:
- run: cargo fmt --check --verbose

clippy:
name: Clippy ${{ matrix.toolchain }}
runs-on: ubuntu-latest
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
strategy:
Expand All @@ -29,9 +28,8 @@ jobs:
env:
RUSTFLAGS: --deny warnings
steps:
- name: Setup Rust
- uses: dtolnay/rust-toolchain@master
id: rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
Expand All @@ -45,7 +43,6 @@ jobs:
- run: cargo doc --offline --no-deps

test:
name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
strategy:
Expand All @@ -59,9 +56,8 @@ jobs:
- ubuntu-latest
- macos-latest
steps:
- name: Setup Rust
- uses: dtolnay/rust-toolchain@master
id: rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: actions/checkout@v4
Expand Down Expand Up @@ -89,11 +85,9 @@ jobs:
env:
RUSTFLAGS: --deny warnings
steps:
- name: Setup Rust
- uses: dtolnay/rust-toolchain@stable
id: rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.triple }}

- name: Install cargo tools
Expand Down Expand Up @@ -123,8 +117,7 @@ jobs:
key: release-${{ matrix.triple }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
path: target/

- name: Build
run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --target ${{ matrix.triple }}
- run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --target ${{ matrix.triple }}

- name: Package tar.gz (*nix)
if: runner.os != 'Windows'
Expand All @@ -134,8 +127,7 @@ jobs:
-C target/${{ matrix.triple }}/release/ mensa-crawler
| gzip --best > ${{ env.ARTIFACT_NAME }}.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.triple }}
path: |
Expand Down

0 comments on commit 760b8b2

Please sign in to comment.