Skip to content

Commit

Permalink
ci: run each buildpack test separately
Browse files Browse the repository at this point in the history
  • Loading branch information
acodeninja committed Nov 1, 2024
1 parent 58ba02a commit 51be709
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:

publish-buildpack:
runs-on: ubuntu-latest
needs:
- enumerate-buildpacks
needs: [ enumerate-buildpacks ]
permissions:
packages: write
contents: read
Expand Down
51 changes: 42 additions & 9 deletions .github/workflows/quality-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,55 @@ run-name: 🔬 @${{ github.triggering_actor }} is checking quality on ${{ github
on: [push]

jobs:
integration-tests:
name: ⚙️ integration tests
enumerate-buildpack-tests:
name: 🔎 enumerate buildpack tests
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.buildpack-tests.outputs.result }}
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
id: buildpack-tests
with:
result-encoding: json
script: |
const {readdir, stat, readFile} = require("node:fs/promises");
const {join, relative} = require("node:path");
return await readdir(process.cwd())
.then(dirs => Promise.all(dirs.map(async d => {
try {
await stat(join(process.cwd(), d, 'buildpack.toml'));
return relative(process.cwd(), join(process.cwd(), d));
} catch (e) {
return null;
}
})))
.then(dirs => dirs.filter(d => Boolean(d)))
.then(dirs => Promise.all(dirs.map(async d => {
const makefile = (await readFile(join(process.cwd(), d, 'Makefile'))).toString();
return makefile.match(/^test-[^:]+/mg)?.map(t => `${d}:${t}`);
})))
.then(dirs => dirs.flat())
.then(dirs => dirs.filter(d => Boolean(d)));
integration-tests:
name: ⚙️ integration test ${{ matrix.buildpack-test }}
needs: [ enumerate-buildpack-tests ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildpack:
- install
- playwright
- python-security
- psql
buildpack-test: ${{ fromJSON(needs.enumerate-buildpack-tests.outputs.tests) }}
steps:
- uses: actions/checkout@v4
- id: setup-tools
uses: buildpacks/github-actions/[email protected]
- id: setup-pack
uses: buildpacks/github-actions/[email protected]
- run: make test
working-directory: ${{ matrix.buildpack }}/
- run: |
BUILDPACK="$(cut -d':' -f1 <<< "${{ matrix.buildpack-test }}")"
TEST_NAME="$(cut -d':' -f2 <<< "${{ matrix.buildpack-test }}")"
echo "Testing buildpack $BUILDPACK with $TEST_NAME"
cd $BUILDPACK || exit 1
make $TEST_NAME

0 comments on commit 51be709

Please sign in to comment.