Skip to content

Commit 5d7e845

Browse files
- Split docker build and test.
1 parent 461a18e commit 5d7e845

File tree

2 files changed

+71
-7
lines changed

2 files changed

+71
-7
lines changed

.github/actionlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ self-hosted-runner:
33
labels:
44
- ubuntu-latest-m
55
- ubuntu-22-04-m
6+
- ubuntu-22-04-arm64-m
67
- arm-ubuntu-22-04-runner-one
78
- macos-13 # should not be necessary
89
- macos-14 # should not be necessary

.github/workflows/build.yml

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ jobs:
11881188
##
11891189
dockerbuild:
11901190
name: Docker Build
1191-
runs-on: ubuntu-22-04-m
1191+
runs-on: ${{ matrix.platform == 'linux/arm64' && 'ubuntu-22-04-arm64-m' || 'ubuntu-22-04-m' }}
11921192
timeout-minutes: ${{ vars.DEFAULT_JOB_TIMEOUT_MIN == '' && 120 || vars.DEFAULT_JOB_TIMEOUT_MIN }}
11931193
strategy:
11941194
fail-fast: false
@@ -1376,7 +1376,7 @@ jobs:
13761376
run: |
13771377
mkdir -p ${{ runner.temp }}/digests
13781378
digest="${{ steps.img_build.outputs.digest }}"
1379-
touch "${{ runner.temp }}/digests/${digest#sha256:}"
1379+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
13801380
13811381
- name: Upload digest
13821382
if: env.BUILD_IMAGE_REQUIRED == 'true'
@@ -1386,11 +1386,73 @@ jobs:
13861386
path: ${{ runner.temp }}/digests/*
13871387
if-no-files-found: error
13881388

1389+
1390+
dockertest:
1391+
name: Docker Test
1392+
needs:
1393+
- dockerbuild
1394+
runs-on: ${{ matrix.platform == 'linux/arm64' && 'ubuntu-22-04-arm64-m' || 'ubuntu-22-04-m' }}
1395+
timeout-minutes: ${{ vars.DEFAULT_JOB_TIMEOUT_MIN == '' && 120 || vars.DEFAULT_JOB_TIMEOUT_MIN }}
1396+
strategy:
1397+
fail-fast: false
1398+
matrix:
1399+
platform:
1400+
- linux/amd64
1401+
- linux/arm64
1402+
db_backend:
1403+
- sqlite
1404+
- postgres_tcp
1405+
steps:
1406+
- name: Prepare
1407+
run: |
1408+
platform=${{ matrix.platform }}
1409+
echo "PLATFORM_PAIR=${platform//\//-}" >> "${GITHUB_ENV}"
1410+
1411+
- name: Docker meta
1412+
id: meta
1413+
uses: docker/metadata-action@v5
1414+
with:
1415+
images: |
1416+
${{ env.STACKQL_IMAGE_NAME }}
1417+
1418+
- name: Download digests
1419+
uses: actions/download-artifact@v4
1420+
if: env.PUSH_IMAGE_REQUIRED == 'true'
1421+
with:
1422+
path: ${{ runner.temp }}/digests
1423+
name: digests-${{ env.PLATFORM_PAIR }}
1424+
1425+
- name: Prepare
1426+
working-directory: ${{ runner.temp }}/digests
1427+
run: |
1428+
platform=${{ matrix.platform }}
1429+
THIS_STACKQL_DIGEST="$(printf '%s' *)"
1430+
if [ "${THIS_STACKQL_DIGEST}" = "" ]; then
1431+
echo "No digest found for platform ${platform}" >&2
1432+
exit 1
1433+
fi
1434+
digestContainsSpaces="$(echo "${THIS_STACKQL_DIGEST}" | grep ' ')"
1435+
if [ "${digestContainsSpaces}" != "" ]; then
1436+
echo "Digest '${THIS_STACKQL_DIGEST}' contains spaces, as found for platform ${platform}" >&2
1437+
exit 1
1438+
fi
1439+
{
1440+
echo "THIS_STACKQL_DIGEST=${THIS_STACKQL_DIGEST}"
1441+
} >> "${GITHUB_ENV}"
1442+
1443+
1444+
- name: Login to Docker Hub
1445+
uses: docker/login-action@v3
1446+
if: env.BUILD_IMAGE_REQUIRED == 'true'
1447+
with:
1448+
username: ${{ secrets.DOCKERHUB_USERNAME }}
1449+
password: ${{ secrets.DOCKERHUB_TOKEN }}
1450+
13891451
- name: Pull by digest
13901452
if: env.BUILD_IMAGE_REQUIRED == 'true'
13911453
run: |
1392-
docker pull --platform ${{ matrix.platform }} ${{ env.STACKQL_IMAGE_NAME }}@${{ steps.img_build.outputs.digest }}
1393-
docker tag ${{ env.STACKQL_IMAGE_NAME }}@${{ steps.img_build.outputs.digest }} ${{ env.STACKQL_IMAGE_NAME }}:latest
1454+
docker pull --platform ${{ matrix.platform }} ${{ env.STACKQL_IMAGE_NAME }}@sha256:${{ env.THIS_STACKQL_DIGEST }}
1455+
docker tag ${{ env.STACKQL_IMAGE_NAME }}@sha256:${{ env.THIS_STACKQL_DIGEST }} ${{ env.STACKQL_IMAGE_NAME }}:latest
13941456
13951457
- name: Debug info
13961458
if: env.BUILD_IMAGE_REQUIRED == 'true'
@@ -1429,13 +1491,13 @@ jobs:
14291491
echo ""
14301492
14311493
- name: Run robot mocked functional tests
1432-
if: success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true'
1494+
if: success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true' && matrix.db_backend == 'sqlite'
14331495
timeout-minutes: ${{ vars.DEFAULT_STEP_TIMEOUT_MIN == '' && 20 || vars.DEFAULT_STEP_TIMEOUT_MIN }}
14341496
run: |
14351497
python cicd/python/build.py --robot-test --config='{ "variables": { "EXECUTION_PLATFORM": "docker" } }'
14361498
14371499
- name: Run POSTGRES BACKEND robot mocked functional tests
1438-
if: success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true'
1500+
if: success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true' && matrix.db_backend == 'postgres_tcp'
14391501
timeout-minutes: ${{ vars.DEFAULT_LONG_STEP_TIMEOUT_MIN == '' && 40 || vars.DEFAULT_LONG_STEP_TIMEOUT_MIN }}
14401502
run: |
14411503
echo "## Stray flask apps to be killed before robot tests ##"
@@ -1455,7 +1517,7 @@ jobs:
14551517
python cicd/python/build.py --robot-test --config='{ "variables": { "EXECUTION_PLATFORM": "docker", "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": true, "SQL_BACKEND": "postgres_tcp" } }'
14561518
14571519
- name: Output from mocked functional tests
1458-
if: always() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true'
1520+
if: always() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true'
14591521
run: |
14601522
cat ./test/robot/reports/output.xml
14611523
@@ -1476,6 +1538,7 @@ jobs:
14761538
runs-on: ubuntu-22.04
14771539
needs:
14781540
- dockerbuild
1541+
- dockertest
14791542
steps:
14801543

14811544
- name: Check out code into the Go module directory

0 commit comments

Comments
 (0)