Disallow std::fs usage (#467) #1032
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: CI | |
| on: | |
| push: | |
| # Avoid duplicate builds on PRs. | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Update Rust toolchain | |
| run: rustup update | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 | |
| - name: Clippy | |
| run: cargo clippy --all-targets --locked -- --deny warnings | |
| - name: rustfmt | |
| run: cargo fmt -- --check | |
| unit-test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Update Rust toolchain | |
| run: rustup update | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 | |
| - name: Run unit tests | |
| run: cargo test --locked | |
| integration-test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| # The dpkg man-db trigger is excessively slow on GHA runners, see e.g.: | |
| # https://github.com/actions/runner-images/issues/10977 | |
| # https://github.com/actions/runner/issues/4030 | |
| # We disable it here so it does not fire at the end of the following apt-get install | |
| - name: Disable man-db auto-update | |
| run: sudo rm -f /var/lib/man-db/auto-update | |
| - name: Install musl-tools | |
| run: sudo apt-get install musl-tools --no-install-recommends | |
| - name: Update Rust toolchain | |
| run: rustup update | |
| - name: Install Rust linux-musl target | |
| run: rustup target add x86_64-unknown-linux-musl | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 | |
| - name: Install Pack CLI | |
| uses: buildpacks/github-actions/setup-pack@f6d0ae15b2e1f021664bf3ee3fc4f9105c1ee4c7 # v5.9.4 | |
| - name: Run integration tests | |
| # Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests). | |
| run: cargo test --locked -- --ignored | |
| print-pack-getting-started-output: | |
| runs-on: ${{ matrix.target == 'aarch64-unknown-linux-musl' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | |
| strategy: | |
| matrix: | |
| target: ["aarch64-unknown-linux-musl", "x86_64-unknown-linux-musl"] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| # The dpkg man-db trigger is excessively slow on GHA runners, see e.g.: | |
| # https://github.com/actions/runner-images/issues/10977 | |
| # https://github.com/actions/runner/issues/4030 | |
| # We disable it here so it does not fire at the end of the following apt-get install | |
| - name: Disable man-db auto-update | |
| run: sudo rm -f /var/lib/man-db/auto-update | |
| - name: Install musl-tools | |
| run: sudo apt-get install -y --no-install-recommends musl-tools | |
| - name: Update Rust toolchain | |
| run: rustup update | |
| - name: Install Rust linux-musl target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 | |
| - name: Install Pack CLI | |
| uses: buildpacks/github-actions/setup-pack@f6d0ae15b2e1f021664bf3ee3fc4f9105c1ee4c7 # v5.9.4 | |
| - name: Pull builder and run images | |
| run: | | |
| docker pull "heroku/builder:24" | |
| docker pull "heroku/heroku:24" | |
| - name: Clone ruby getting started guide | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: heroku/ruby-getting-started | |
| path: tmp/ruby-getting-started | |
| - name: Install libcnb-cargo for `cargo libcnb package` command | |
| run: cargo install libcnb-cargo | |
| - name: Compile ruby buildpack | |
| run: cargo libcnb package --target ${{ matrix.target }} | |
| - name: "PRINT: Getting started guide output" | |
| run: pack build my-image --force-color --builder heroku/builder:24 --trust-extra-buildpacks --buildpack packaged/${{ matrix.target }}/debug/heroku_ruby --path tmp/ruby-getting-started --pull-policy never | |
| - name: "PRINT: Cached getting started guide output" | |
| run: pack build my-image --force-color --builder heroku/builder:24 --trust-extra-buildpacks --buildpack packaged/${{ matrix.target }}/debug/heroku_ruby --path tmp/ruby-getting-started --pull-policy never | |
| unit-test-coverage: | |
| name: Generate test coverage report | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Install nightly Rust toolchain | |
| run: rustup install nightly | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15 | |
| with: | |
| tool: cargo-llvm-cov | |
| - name: Run unit tests and generate coverage report | |
| run: cargo +nightly llvm-cov --locked --html | |
| - name: Upload HTML coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "llvm-cov-html-${{github.event.repository.name}}-${{github.sha}}" | |
| path: "target/llvm-cov/html" | |
| if-no-files-found: "error" |