Add PAR2 creation support #111
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 # Disable incremental compilation for CI (not reused) | |
| CARGO_PROFILE_DEV_DEBUG: 0 # Disable debug info in dev builds (faster compile) | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "test" | |
| cache-on-failure: true | |
| - name: Cache par2cmdline | |
| id: cache-par2 | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/bin/par2 | |
| key: ${{ runner.os }}-par2cmdline | |
| - name: Install par2cmdline | |
| if: steps.cache-par2.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y par2 | |
| mkdir -p ~/bin | |
| cp /usr/bin/par2 ~/bin/par2 | |
| - name: Add par2 to PATH | |
| run: echo "$HOME/bin" >> $GITHUB_PATH | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: llvm-tools-preview | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "coverage" | |
| cache-on-failure: true | |
| - name: Cache par2cmdline | |
| id: cache-par2-coverage | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/bin/par2 | |
| key: ${{ runner.os }}-par2cmdline | |
| - name: Install par2cmdline | |
| if: steps.cache-par2-coverage.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y par2 | |
| mkdir -p ~/bin | |
| cp /usr/bin/par2 ~/bin/par2 | |
| - name: Add par2 to PATH | |
| run: echo "$HOME/bin" >> $GITHUB_PATH | |
| - name: Cache cargo-llvm-cov binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/bin/cargo-llvm-cov | |
| key: ${{ runner.os }}-cargo-llvm-cov-0.6.14 | |
| - name: Install cargo-llvm-cov | |
| run: | | |
| if ! command -v cargo-llvm-cov &> /dev/null; then | |
| cargo install cargo-llvm-cov --version 0.6.14 --locked | |
| fi | |
| - name: Generate coverage report | |
| run: | | |
| cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: lcov.info | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Archive coverage results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: lcov.info |