-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: run each buildpack test separately
- Loading branch information
1 parent
58ba02a
commit 51be709
Showing
2 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |