Skip to content

ci(deps): bump the github-actions group across 1 directory with 2 updates #130

ci(deps): bump the github-actions group across 1 directory with 2 updates

ci(deps): bump the github-actions group across 1 directory with 2 updates #130

Workflow file for this run

name: CI
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
# Prevent multiple CI runs from running simultaneously for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache target directory
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Generate clippy report for SonarCloud
run: cargo clippy --message-format=json > clippy.json
- name: Upload clippy report
uses: actions/upload-artifact@v7
with:
name: clippy-report
path: clippy.json
- name: Run tests
run: cargo test --verbose
- name: Run integration tests
run: cargo test --test integration_tests
- name: Build release binary
run: cargo build --release
- name: Test CLI functionality
run: |
# Test basic CLI functionality
./target/release/cg-bundler --version
./target/release/cg-bundler --help
build-cross-platform:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache target directory
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-
- name: Build
run: cargo build --release
- name: Test binary (Unix)
if: matrix.os != 'windows-latest'
run: |
./target/release/cg-bundler --version
- name: Test binary (Windows)
if: matrix.os == 'windows-latest'
run: |
.\target\release\cg-bundler.exe --version
code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
# Cache cargo tools to avoid reinstalling them every time
- name: Cache cargo tools
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/cargo-audit
~/.cargo/bin/cargo-deny
~/.cargo/bin/cargo-edit
~/.cargo/bin/cargo-llvm-cov
key: ${{ runner.os }}-cargo-tools-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-tools-
- name: Install cargo tools
run: |
if ! command -v cargo-llvm-cov &> /dev/null; then
cargo install cargo-llvm-cov
fi
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
files: lcov.info
fail_ci_if_error: false
- name: Upload coverage artifact for SonarCloud
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: lcov.info
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: [test, code-coverage]
permissions:
contents: read
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download clippy report
uses: actions/download-artifact@v8
with:
name: clippy-report
- name: Download coverage report
uses: actions/download-artifact@v8
with:
name: coverage-report
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v7
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}