mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-23 12:17:45 +08:00
ci(validate): split lint
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
1fb5d2a9ee
commit
6d95fb586e
67
.github/workflows/validate.yml
vendored
67
.github/workflows/validate.yml
vendored
@ -17,17 +17,63 @@ on:
|
|||||||
- '.github/releases.json'
|
- '.github/releases.json'
|
||||||
|
|
||||||
jobs:
|
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: |
|
||||||
|
let def = {};
|
||||||
|
await core.group(`Parsing definition`, async () => {
|
||||||
|
const printEnv = Object.assign({}, process.env, {
|
||||||
|
GOLANGCI_LINT_MULTIPLATFORM: process.env.GITHUB_REPOSITORY === 'docker/buildx' ? '1' : ''
|
||||||
|
});
|
||||||
|
const resPrint = await exec.getExecOutput('docker', ['buildx', 'bake', 'validate', '--print'], {
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
env: printEnv
|
||||||
|
});
|
||||||
|
if (resPrint.stderr.length > 0 && resPrint.exitCode != 0) {
|
||||||
|
throw new Error(res.stderr);
|
||||||
|
}
|
||||||
|
def = JSON.parse(resPrint.stdout.trim());
|
||||||
|
});
|
||||||
|
await core.group(`Generating matrix`, async () => {
|
||||||
|
const includes = [];
|
||||||
|
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:
|
validate:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
include: ${{ fromJson(needs.prepare.outputs.includes) }}
|
||||||
- lint
|
|
||||||
- lint-gopls
|
|
||||||
- validate-vendor
|
|
||||||
- validate-docs
|
|
||||||
- validate-generated-files
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Prepare
|
name: Prepare
|
||||||
@ -44,6 +90,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
-
|
-
|
||||||
name: Run
|
name: Validate
|
||||||
run: |
|
uses: docker/bake-action@v4
|
||||||
make ${{ matrix.target }}
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
set: |
|
||||||
|
*.platform=${{ matrix.platform }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user