validate #222
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: validate | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'v[0-9]*' | |
tags: | |
- 'v*' | |
pull_request: | |
paths-ignore: | |
- '.github/releases.json' | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
outputs: | |
includes: ${{ steps.matrix.outputs.includes }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Matrix | |
id: matrix | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const resPrint = await exec.getExecOutput('docker', ['buildx', 'bake', 'validate', '--print'], { | |
ignoreReturnCode: true, | |
silent: true | |
}); | |
if (resPrint.stderr.length > 0 && resPrint.exitCode != 0) { | |
throw new Error(res.stderr); | |
} | |
const includes = []; | |
const def = JSON.parse(resPrint.stdout.trim()); | |
for (const targetName of Object.keys(def.target)) { | |
const target = def.target[targetName]; | |
if (target.platforms && target.platforms.length > 0) { | |
target.platforms.forEach(platform => { | |
includes.push({ | |
target: targetName, | |
platform: platform | |
}); | |
}); | |
} else { | |
includes.push({ | |
target: targetName | |
}); | |
} | |
} | |
core.info(JSON.stringify(includes, null, 2)); | |
core.setOutput('includes', JSON.stringify(includes)); | |
validate: | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.prepare.outputs.includes) }} | |
steps: | |
- | |
name: Prepare | |
run: | | |
if [ "$GITHUB_REPOSITORY" = "docker/buildx" ]; then | |
echo "GOLANGCI_LINT_MULTIPLATFORM=1" >> $GITHUB_ENV | |
fi | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- | |
name: Validate | |
uses: docker/bake-action@v4 | |
with: | |
targets: ${{ matrix.target }} |