Skip to content

Commit

Permalink
ci: use matrix to test containerd backed image store
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Oct 13, 2023
1 parent 03decbc commit 7089222
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 9 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/.test-prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# reusable workflow
name: .test-prepare

# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025

on:
workflow_call:
outputs:
matrix:
description: Test matrix
value: ${{ jobs.run.outputs.matrix }}

jobs:
run:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create matrix
id: set
uses: actions/github-script@v6
with:
script: |
let matrix = ['graphdriver'];
if ("${{ contains(github.event.pull_request.labels.*.name, 'containerd-integration') || github.event_name != 'pull_request' }}" == "true") {
matrix.push('snapshotter');
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(matrix)}`);
core.setOutput('matrix', JSON.stringify(matrix));
});
3 changes: 2 additions & 1 deletion .github/workflows/.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ env:
TESTSTAT_VERSION: v0.1.3
ITG_CLI_MATRIX_SIZE: 6
DOCKER_EXPERIMENTAL: 1
DOCKER_GRAPHDRIVER: overlay2
DOCKER_GRAPHDRIVER: ${{ inputs.storage == 'snapshotter' && 'overlayfs' || 'overlay2' }}
TEST_INTEGRATION_USE_SNAPSHOTTER: ${{ inputs.storage == 'snapshotter' && '1' || '' }}

jobs:
unit:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ jobs:
- builtin
- containerd
test: ${{ fromJson(needs.integration-test-prepare.outputs.matrix) }}
exclude:
- storage: snapshotter
runtime: builtin
env:
GOPATH: ${{ github.workspace }}\go
GOBIN: ${{ github.workspace }}\go\bin
Expand Down Expand Up @@ -354,6 +357,11 @@ jobs:
"--exec-root=$env:TEMP\moby-exec", `
"--pidfile=$env:TEMP\docker.pid", `
"--register-service"
If ("${{ inputs.storage }}" -eq "snapshotter") {
# Make the env-var visible to the service-managed dockerd, as there's no CLI flag for this option.
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_SNAPSHOTTER=1
echo "TEST_INTEGRATION_USE_SNAPSHOTTER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
Write-Host "Starting service"
Start-Service -Name docker
Write-Host "Service started successfully!"
Expand Down Expand Up @@ -491,6 +499,9 @@ jobs:
runtime:
- builtin
- containerd
exclude:
- storage: snapshotter
runtime: builtin
steps:
-
name: Set up Go
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ jobs:
*.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
*.output=type=cacheonly
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco

test:
needs:
- test-prepare
- build-dev
uses: ./.github/workflows/.test.yml
strategy:
fail-fast: false
matrix:
storage:
- graphdriver
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
with:
storage: ${{ matrix.storage }}

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/windows-2019.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml

run:
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco

run:
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
strategy:
fail-fast: false
matrix:
storage:
- graphdriver
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
with:
os: windows-2019
storage: ${{ matrix.storage }}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/windows-2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml

run:
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco

run:
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
strategy:
fail-fast: false
matrix:
storage:
- graphdriver
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
with:
os: windows-2022
storage: ${{ matrix.storage }}
Expand Down

0 comments on commit 7089222

Please sign in to comment.