mirror of https://github.com/sysown/proxysql
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
5.9 KiB
174 lines
5.9 KiB
name: CI-3p-django-framework
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
trigger:
|
|
type: string
|
|
infradb:
|
|
type: string
|
|
connector:
|
|
type: string
|
|
|
|
env:
|
|
TESTTREE: ${{ inputs.testtree || 'main' }}
|
|
TESTNAME: django-framework
|
|
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: [ 'mysql57', 'mysql80', 'mysql84', 'mysql90', 'mariadb10.5', 'mariadb10.6', 'mariadb10.11', 'mariadb11.2', 'mariadb11.4', 'mariadb11.5' ]
|
|
# infradb: [ 'mysql80', 'mysql81', 'mysql82', 'mariadb10', 'mariadb11' ]
|
|
infradb: ${{ fromJson( inputs.infradb ) }}
|
|
# connector: [ 'pymysql' ]
|
|
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: ${{ env.TESTTREE }}
|
|
fetch-depth: 1
|
|
path: 'proxysql_3p_testing'
|
|
token: ${{ secrets.gh_token }}
|
|
sparse-checkout: |
|
|
common
|
|
libs
|
|
infra-docker-hoster
|
|
test_django-framework
|
|
# 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/.git/
|
|
proxysql/binaries/
|
|
|
|
- name: Prepare
|
|
run: |
|
|
set +e
|
|
|
|
cd proxysql_3p_testing/
|
|
./setup.sh test_django-framework
|
|
git switch ${{ env.TESTTREE }}
|
|
|
|
# use cached build
|
|
rm -rf ./proxysql && mv ../proxysql .
|
|
|
|
# extend timout
|
|
cd test_django-framework
|
|
#sed -i 's/timeout -v -s1 800 //' run-tests.bash
|
|
|
|
# fix permissions
|
|
mkdir django-framework/cache
|
|
chmod -R 777 django-framework/cache
|
|
|
|
# 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_django-framework
|
|
#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: |
|
|
set +e
|
|
|
|
cd proxysql_3p_testing/test_django-framework
|
|
BASELINE=$(gh variable -R ${{ github.repository }} list | grep -i BASELINE_3P_DJANGO_FRAMEWORK_${INFRADB//./}_${CONNECTOR//./} | awk '{ print $2 }')
|
|
|
|
FAILS=$(cat logs/*run-tests.log | grep -oP 'FAILED \(failures=\d+' | tr '=' ' ' | awk '{ print $3 }')
|
|
if [[ -z ${FAILS} ]]; then
|
|
FAILS=$(cat logs/*run-tests.log | grep -oP 'OK \(skipped=\d+')
|
|
if [[ -z ${FAILS} ]]; then
|
|
echo "Baseline '${BASELINE}' WARN: no results found"
|
|
exit 0
|
|
else
|
|
FAILS=0
|
|
fi
|
|
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_DJANGO_FRAMEWORK_${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_django-framework/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 }}'
|