ci: add ci-mysql56-single-g1 reusable workflow

Context
-------
PR sysown/proxysql#5166 (branch 'session-track-system-variable' on v3.0)
introduces a new TAP group 'mysql56-single-g1' backed by the
'infra-dbdeployer-mysql56-single' fixture. Three tests are registered
against it in 'test/tap/groups/groups.json':

  - mysql-session_track_variables_enforced-t
  - mysql-session_track_variables_ff_mysql56-t
  - mysql-session_track_variables_optional-t

The v3.0 side of the PR adds the thin caller 'CI-mysql56-single-g1.yml'
which delegates to this reusable. Without this file the caller fails
with "workflow not found" when invoked.

Changes
-------
Adds 'ci-mysql56-single-g1.yml' modelled verbatim on 'ci-mysql84-g1.yml'.
The only substantive differences are cosmetic / routing:

  - 'matrix.infradb: [ mysql56 ]'
    Per 'doc/GH-Actions/README.md' ("What a sibling differs in") this
    value is *cosmetic for routing* -- 'ensure-infras.bash' ignores it
    and picks the real backend from
    'test/tap/groups/mysql56-single/infras.lst' (which points at
    'infra-dbdeployer-mysql56-single'). The value is, however, *displayed*
    in the check-run label via 'env.MATRIX', so reviewers see
    'CI-mysql56-single-g1 / tests (mysql56)' rather than a misleading
    'mysql57' tag.

  - 'INFRA_ID="ci-mysql56-single-g1"' in the start, run, and cleanup
    steps.

  - 'TAP_GROUP="mysql56-single-g1"'.

Nothing else changed from the 'ci-mysql84-g1.yml' template: the same
sparse checkout, the same ubuntu22-tap src + test cache keys, the same
LouisBrunner check-run bracketing, the same 'Fix artifact permissions'
sudo chmod workaround for root-owned logs written inside docker
containers, and the same always-run cleanup that calls
'stop-proxysql-isolated.bash' followed by 'destroy-infras.bash'.

Landing order
-------------
This commit ships first on 'GH-Actions', then the caller
'CI-mysql56-single-g1.yml' on v3.0 (already prepared in the
session-track-system-variable branch of PR #5166) becomes functional.
Between the two commits landing, the caller will fail -- this is the
expected window and matches how every existing caller/reusable pair was
introduced.
pull/5657/head
Rene Cannao 4 weeks ago
parent 0ae7e2cde6
commit 006c78538e

@ -0,0 +1,137 @@
name: CI-mysql56-single-g1
on:
workflow_dispatch:
workflow_call:
inputs:
trigger:
type: string
env:
SHA: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_sha || github.sha }}
jobs:
tests:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# 'mysql56' here is cosmetic: it feeds the 'MATRIX' env below which is
# interpolated into the check-run display name so reviewers see
# 'CI-mysql56-single-g1 / tests (mysql56)' in the PR UI. The actual
# backend is selected by 'ensure-infras.bash' from the group's
# 'infras.lst' file (test/tap/groups/mysql56-single/infras.lst),
# which points to 'infra-dbdeployer-mysql56-single'.
infradb: [ 'mysql56' ]
env:
BLDCACHE: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_sha || github.sha }}_ubuntu22-tap_src
MATRIX: '(${{ matrix.infradb }})'
steps:
- uses: LouisBrunner/checks-action@v2.0.0
id: checks
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: '${{ github.workflow }} / ${{ github.job }} ${{ env.MATRIX }}'
repo: ${{ github.repository }}
sha: ${{ env.SHA }}
status: 'in_progress'
details_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ env.SHA }}
path: 'proxysql'
sparse-checkout: |
test/infra
test/tap/groups
test/scripts
- name: Cache restore src
id: cache-src
uses: actions/cache/restore@v4
with:
key: ${{ env.BLDCACHE }}
fail-on-cache-miss: true
path: |
proxysql/src/
- name: Cache restore test
id: cache-test
uses: actions/cache/restore@v4
with:
key: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_sha || github.sha }}_ubuntu22-tap_test
fail-on-cache-miss: true
path: |
proxysql/test/
- name: Verify binary
run: |
chmod +x proxysql/src/proxysql
file proxysql/src/proxysql
- name: Build CI base image
run: |
cd proxysql/test/infra/docker-base
docker build -t proxysql-ci-base:latest .
- name: Start infrastructure
run: |
cd proxysql
export INFRA_ID="ci-mysql56-single-g1"
export TAP_GROUP="mysql56-single-g1"
export SKIP_CLUSTER_START=1
test/infra/control/ensure-infras.bash
- name: Run mysql56-single-g1 tests
run: |
cd proxysql
export INFRA_ID="ci-mysql56-single-g1"
export TAP_GROUP="mysql56-single-g1"
export SKIP_CLUSTER_START=1
test/infra/control/run-tests-isolated.bash
- name: Cleanup
if: always()
run: |
set +e
cd proxysql
export INFRA_ID="ci-mysql56-single-g1"
export TAP_GROUP="mysql56-single-g1"
docker logs proxysql.ci-mysql56-single-g1 2>&1 | tail -50 || true
test/infra/control/stop-proxysql-isolated.bash
test/infra/control/destroy-infras.bash
- name: Fix artifact permissions
if: ${{ failure() && !cancelled() }}
run: |
# actions/upload-artifact dies with EACCES when it scandirs into
# directories under ci_*_logs/ that were created inside docker
# build containers (root-owned). Make everything readable by the
# runner user before upload. sudo required because files are
# root-owned; 2>/dev/null + || true because the path may not
# exist on all failure paths (e.g. a cache-restore failure before
# any test even runs).
sudo chmod -R a+rX proxysql/ci_*_logs/ 2>/dev/null || true
- name: Archive artifacts logs
if: ${{ failure() && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.workflow }}-${{ env.SHA }}-logs-run#${{ github.run_number }}
path: |
proxysql/ci_*_logs/
- uses: LouisBrunner/checks-action@v2.0.0
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
check_id: ${{ steps.checks.outputs.check_id }}
repo: ${{ github.repository }}
sha: ${{ env.SHA }}
conclusion: ${{ job.status }}
details_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Loading…
Cancel
Save