🔬 @acodeninja is checking quality on feat/postgres-client-tools #92
Workflow file for this run
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: quality-checks | |
run-name: 🔬 @${{ github.triggering_actor }} is checking quality on ${{ github.ref_name }} | |
on: [push] | |
jobs: | |
unit-tests: | |
name: 🧪 unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "version=$(grep -Ee 'go [0-9\.]+' go.mod | awk '{ print $2; }')" >> $GITHUB_OUTPUT | |
id: go_mod | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ steps.go_mod.outputs.version }} | |
cache-dependency-path: "**/*.sum" | |
- run: go test ./... | |
enumerate-integration-tests: | |
name: 🔎 enumerate buildpack tests | |
runs-on: ubuntu-latest | |
needs: [ unit-tests ] | |
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-integration-tests ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
buildpack-test: ${{ fromJSON(needs.enumerate-integration-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: | | |
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 |