mirror of
https://github.com/moby/buildkit.git
synced 2026-08-07 08:10:44 +00:00
ci(validate): split by platform
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
71
.github/workflows/validate.yml
vendored
71
.github/workflows/validate.yml
vendored
@@ -27,17 +27,52 @@ jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
targets: ${{ steps.generate.outputs.targets }}
|
||||
includes: ${{ steps.matrix.outputs.includes }}
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: List targets
|
||||
id: generate
|
||||
uses: docker/bake-action/subaction/list-targets@v6
|
||||
name: Matrix
|
||||
id: matrix
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
target: validate
|
||||
script: |
|
||||
let def = {};
|
||||
await core.group(`Parsing definition`, async () => {
|
||||
const printEnv = Object.assign({}, process.env, {
|
||||
GOLANGCI_LINT_MULTIPLATFORM: process.env.GITHUB_REPOSITORY === 'moby/buildkit' ? '1' : '',
|
||||
ARCHUTIL_MULTIPLATFORM: process.env.GITHUB_REPOSITORY === 'moby/buildkit' ? '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:
|
||||
runs-on: ubuntu-24.04
|
||||
@@ -46,14 +81,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||
include: ${{ fromJson(needs.prepare.outputs.includes) }}
|
||||
steps:
|
||||
-
|
||||
name: Prepare
|
||||
run: |
|
||||
if [ "$GITHUB_REPOSITORY" = "moby/buildkit" ]; then
|
||||
echo "GOLANGCI_LINT_MULTIPLATFORM=1" >> $GITHUB_ENV
|
||||
fi
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@@ -66,21 +95,5 @@ jobs:
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
archutil-arm64:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: ${{ env.SETUP_BUILDX_VERSION }}
|
||||
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
|
||||
buildkitd-flags: --debug
|
||||
-
|
||||
name: Validate
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
targets: validate-archutil
|
||||
set: |
|
||||
*.platform=linux/arm64
|
||||
*.platform=${{ matrix.platform }}
|
||||
|
||||
@@ -42,6 +42,10 @@ variable "GOLANGCI_LINT_MULTIPLATFORM" {
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "ARCHUTIL_MULTIPLATFORM" {
|
||||
default = null
|
||||
}
|
||||
|
||||
# Defines the output folder
|
||||
variable "DESTDIR" {
|
||||
default = ""
|
||||
@@ -214,6 +218,10 @@ target "validate-archutil" {
|
||||
dockerfile = "./hack/dockerfiles/archutil.Dockerfile"
|
||||
target = "validate"
|
||||
output = ["type=cacheonly"]
|
||||
platforms = ARCHUTIL_MULTIPLATFORM != null ? [
|
||||
"linux/amd64",
|
||||
"linux/arm64"
|
||||
] : []
|
||||
}
|
||||
|
||||
target "validate-shfmt" {
|
||||
|
||||
Reference in New Issue
Block a user