Feature/add test #57
Workflow file for this run
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: Build container | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| run-clippy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - run: echo "::add-matcher::.github/clippy-matcher.json" | |
| - run: cargo clippy --all-targets --all-features -- -D warnings | |
| run-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Setup test coverage env | |
| run: | | |
| cargo install grcov | |
| rustup component add llvm-tools | |
| - run: cargo test --locked | |
| env: | |
| LLVM_PROFILE_FILE: target/debug/coverage/grcov-%p-%m.profraw | |
| RUSTFLAGS: -Cinstrument-coverage | |
| - name: Generate coverage | |
| run: | | |
| grcov target/debug/coverage/grcov-*.profraw \ | |
| --branch \ | |
| --ignore-not-existing \ | |
| --binary-path ./target/debug/ \ | |
| --source-dir ./src \ | |
| --output-types cobertura,markdown \ | |
| --ignore "/*" \ | |
| --output-path ./target/debug/coverage/ | |
| - name: Set summary | |
| run: cat ./target/debug/coverage/markdown.md >> $GITHUB_STEP_SUMMARY | |
| build-container: | |
| permissions: | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: checkout | |
| uses: actions/checkout@v4 | |
| - id: setup-pack | |
| uses: buildpacks/github-actions/setup-pack@v5.8.11 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: https://ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: build-image | |
| run: | | |
| pack build ghcr.io/simonerm/imtrand:next \ | |
| --buildpack paketo-community/rust \ | |
| --builder paketobuildpacks/builder-jammy-buildpackless-base:latest \ | |
| --cache-image ghcr.io/simonerm/imtrand-cache:next \ | |
| --publish |