add ci-3p-postgresql

fix/3p-ci-error-handling
Miro Stauder 2 years ago committed by GitHub
parent da1251659b
commit 3a5797c196
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,152 @@
name: CI-3p-postgresql
on:
workflow_dispatch:
workflow_call:
inputs:
trigger:
type: string
infradb:
type: string
connector:
type: string
env:
TESTNAME: postgresql
TESTDIST: debian12
SHA: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_sha || github.sha }}
jobs:
test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
infradb: ${{ fromJson( inputs.infradb ) }}
connector: ${{ fromJson( inputs.connector ) }}
env:
INFRADB: ${{ matrix.infradb }}
CONNECTOR: ${{ matrix.connector }}
BLDCACHE: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_sha || github.sha }}_debian12_bin
MATRIX: '(${{ matrix.infradb }},${{ matrix.connector }})'
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'
# action_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
details_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Checkout proxysql_3p_testing
uses: actions/checkout@v4
with:
repository: 'proxysql/proxysql_3p_testing'
ref: 'main'
fetch-depth: 1
path: 'proxysql_3p_testing'
token: ${{ secrets.gh_token }}
sparse-checkout: |
libs
infra-docker-hoster
test_proxysql
# proxysql
- name: Wait for cache
env:
GH_TOKEN: ${{ secrets.gh_token }}
run: |
echo "Wating for cache '${BLDCACHE}' ..."
sleep $(( $RANDOM / 1024 ))
PROBE="$(gh cache list --limit 300 --repo ${{ github.repository }} | grep -i ${BLDCACHE} || echo '')"
while [[ -z ${PROBE} ]]; do
echo "Wating for cache '${BLDCACHE}' ..."
sleep 30
PROBE="$(gh cache list --limit 300 --repo ${{ github.repository }} | grep -i ${BLDCACHE} || echo '')"
done
echo "Cache available '${BLDCACHE}'"
- name: Cache restore bin
uses: actions/cache/restore@v4
with:
key: ${{ env.BLDCACHE }}
fail-on-cache-miss: true
path: |
proxysql/binaries/
- name: Prepare
run: |
set +e
cd proxysql_3p_testing/
git sparse-checkout list
./setup.sh test_proxysql
# use cached build
rm -rf ./proxysql && mv ../proxysql .
# set tested database infra
sed -i 's/^fn_test_proxysql m/#fn_test_proxysql m/' run-tests.bash
sed -i 's/^fn_test_proxysql_dev m/#fn_test_proxysql_dev m/' run-tests.bash
sed -i '/^fn_start_prep$/a fn_test_proxysql_dev ${{ matrix.infradb }}' run-tests.bash
- name: Run tests
run: |
set +e
cd proxysql_3p_testing/test_postgresql
sed -i 's/docker-compose/docker compose/g' run-tests.bash
./run-tests.bash
RC=$?
#sudo chmod -R 777 ${{ github.workspace }}/*
exit $RC
- name: Check baseline
env:
GH_TOKEN: ${{ secrets.gh_token }}
run: |
cd proxysql_3p_testing/test_postgresql
BASELINE=$(gh variable -R ${{ github.repository }} list | grep -i BASELINE_3P_POSTGRESQL_${INFRADB//./}_${CONNECTOR//./} | awk '{ print $2 }')
FAILS=$(cat logs/*run-tests.log | grep 'FAIL' | grep ' / ' | awk '{ print $2 }')
if [[ -z ${FAILS} ]]; then
echo "Baseline '${BASELINE:-10000}' WARN: no results found"
exit 0
fi
if [[ ${FAILS} -gt ${BASELINE:-10000} ]]; then
echo "Baseline '${BASELINE:-10000}' FAIL: FAILS = ${FAILS}"
exit 1
else
echo "Baseline '${BASELINE:-10000}' PASS: FAILS = ${FAILS}"
MAIN=$(curl -s https://api.github.com/repos/${{ github.repository }} | jq --raw-output .default_branch)
if [[ ${MAIN} == ${{ github.ref_name }} ]]; then
gh variable -R ${{ github.repository }} set BASELINE_3P_POSTGRESQL_${INFRADB//./}_${CONNECTOR//./} -b "${FAILS}"
fi
fi
- name: Archive artifacts logs
if: ${{ failure() && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.workflow }}-${{ env.SHA }}-${{ matrix.infradb }}-${{ matrix.connector }}-logs-run#${{ github.run_number }}
path: |
proxysql_3p_testing/test_postgresql/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 }}
# action_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
details_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Loading…
Cancel
Save