Improve pnpm engine errors (#1077) #1989
This file contains 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: | |
branches: ["main"] | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
shell-lint: | |
runs-on: ubuntu-24.04 | |
container: | |
image: koalaman/shellcheck-alpine:v0.9.0 | |
steps: | |
- run: apk add git | |
- run: apk add shfmt --repository=http://dl-3.alpinelinux.org/alpine/edge/community | |
- uses: actions/checkout@v4 | |
- name: shellcheck | |
run: shfmt -f . | grep -v ^test/ | xargs shellcheck | |
- name: shfmt | |
run: shfmt -f . | grep -v ^test/ | grep -v '_shpec.sh$' | xargs shfmt -d | |
rust-lint: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 | |
- name: Clippy | |
run: cargo clippy --all-targets --locked -- --deny warnings | |
- name: rustfmt | |
run: cargo fmt -- --check | |
rust-unit-test: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 | |
- name: Run unit tests | |
run: cargo test --locked | |
# Currently a separate job since the #coverage(off) attribute requires nightly Rust. As soon as we can use llvm-cov | |
# without Rust nightly, we should merge this job with the regular unit tests. | |
unit-test-coverage: | |
name: Generate test coverage report | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install nightly Rust toolchain | |
run: rustup install nightly | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@575f713d0233afba556737a7b85080563be14186 # v2.49.43 | |
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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: "llvm-cov-html-${{github.event.repository.name}}-${{github.sha}}" | |
path: "target/llvm-cov/html" | |
if-no-files-found: "error" | |
find-libcnb-buildpacks: | |
name: Find libcnb buildpacks | |
runs-on: ubuntu-24.04 | |
outputs: | |
libcnb-buildpacks: ${{ steps.find-buildpack-dirs.outputs.buildpacks }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- id: find-buildpack-dirs | |
name: Find libcnb buildpack directories | |
run: | | |
echo "buildpacks=$( \ | |
find . -type d -execdir test -e "{}/buildpack.toml" -a -e "{}/Cargo.toml" \; -print \ | |
| sort \ | |
| uniq \ | |
| jq -nRc '[inputs] | |
| map({ dir: ., name: split("/") | last | split("nodejs-") | last } | |
| [ | |
. + { builder_tag: 20, arch: "amd64" }, | |
. + { builder_tag: 22, arch: "amd64" }, | |
. + { builder_tag: 24, arch: "amd64" }, | |
. + { builder_tag: 24, arch: "arm64" } | |
]) | |
| flatten' \ | |
)" >> $GITHUB_OUTPUT | |
rust-integration-test: | |
name: ${{ matrix.name }} (${{ matrix.builder_tag }}, ${{ matrix.arch }}) | |
runs-on: ${{ matrix.arch == 'arm64' && 'pub-hk-ubuntu-24.04-arm-medium' || 'ubuntu-24.04' }} | |
env: | |
INTEGRATION_TEST_CNB_BUILDER: heroku/builder:${{ matrix.builder_tag }} | |
needs: find-libcnb-buildpacks | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.find-libcnb-buildpacks.outputs.libcnb-buildpacks) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install musl-tools | |
run: sudo apt-get install musl-tools -y --no-install-recommends | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Install Rust linux-musl target | |
run: rustup target add ${{ matrix.arch == 'arm64' && 'aarch64-unknown-linux-musl' || 'x86_64-unknown-linux-musl' }} | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 | |
- name: Install Pack CLI | |
uses: buildpacks/github-actions/setup-pack@d82294e03fd6b8e8484cde2ee166788876e366e3 # v5.8.10 | |
- name: Pull builder image | |
run: docker pull ${{ env.INTEGRATION_TEST_CNB_BUILDER }} | |
- name: Pull run image | |
run: | | |
RUN_IMAGE=$( | |
docker inspect --format='{{index .Config.Labels "io.buildpacks.builder.metadata"}}' '${{ env.INTEGRATION_TEST_CNB_BUILDER }}' \ | |
| jq --exit-status --raw-output '.stack.runImage.image' | |
) | |
docker pull "${RUN_IMAGE}" | |
- name: Run integration tests | |
working-directory: ${{ matrix.dir }} | |
run: cargo test --locked -- --ignored --test-threads 16 | |
shpec: | |
runs-on: ubuntu-24.04 | |
container: | |
image: heroku/heroku:${{ matrix.stack-version }}-build | |
strategy: | |
matrix: | |
stack-version: | |
- '20' | |
- '22' | |
buildpack-dir: | |
- buildpacks/npm | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install shpec | |
run: sh -c "`curl -L https://raw.githubusercontent.com/rylnd/shpec/master/install.sh`" | |
- name: Shpec unit tests on heroku-${{ matrix.stack-version }} | |
run: shpec ${{ matrix.buildpack-dir }}/shpec/*_shpec.sh |