Skip to content

[misc] simplify common structure #33

[misc] simplify common structure

[misc] simplify common structure #33

Workflow file for this run

---
name: Run CI Tests
on:
push:
branches: ['master', 'develop', 'feature/**', 'maintenance/**']
pull_request:
workflow_dispatch:
schedule:
# Run weekly on Sundays at 2 AM UTC
- cron: '0 2 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
TEST_DB_HOST: mariadb.example.com
TEST_DB_PORT: 3306
TEST_DB_USER: root
TEST_DB_PASSWORD: "heyPassw-!*20oRd"
TEST_DB_DATABASE: testn
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.final-matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
name: build matrix
uses: rusher/mariadb-test-build-matrix@main
with:
additional-matrix: '[{"name": "MariaDB 11.4", "os": "ubuntu-latest", "db-type": "community", "db-tag": "11.4", "node": 24}, {"name": "MariaDB 11.4", "os": "ubuntu-latest", "db-type": "community", "db-tag": "11.4", "node": 20}]'
ci:
name: ${{ matrix.name }}${{ matrix.node != 22 && format(' - node {0}', matrix.node) || '' }}
needs: setup
timeout-minutes: 50
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
steps:
- uses: actions/checkout@v4
- name: Setup Test Environment
id: setup-env
uses: rusher/mariadb-test-setup@master
with:
node-version: ${{ matrix.node }}
db-type: ${{ matrix.db-type }}
db-tag: ${{ matrix.db-tag }}
test-db-password: ${{ env.TEST_DB_PASSWORD }}
test-db-database: ${{ env.TEST_DB_DATABASE }}
test-db-port: ${{ env.TEST_DB_PORT }}
additional-conf: ${{ matrix.additional-conf || '' }}
registry-user: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_USER || '' }}
registry-password: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || '' }}
os: ${{ matrix.os }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Run Tests
run: npm run coverage:test
env:
LOCAL_DB: ${{ steps.setup-env.outputs.database-type }}
DB_TYPE: ${{ matrix.db-type }}
TEST_DB_SERVER_CERT: ${{ matrix.db-type == 'container' && './.github/workflows/certs/server.crt' || '' }}
- name: Download Codecov uploader
shell: bash
run: |
case "$RUNNER_OS" in
Windows)
powershell -Command Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
choco install -y --force nodejs-lts
# force refresh path
export PATH=$(cmd.exe //c "refreshenv > nul & C:\Progra~1\Git\bin\bash -c 'echo \$PATH' ")
;;
Linux)
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
ls -lrt
;;
macOS)
curl -Os https://uploader.codecov.io/latest/macos/codecov
chmod +x codecov
ls -lrt
;;
esac
- name: Generate Coverage Report
shell: bash
run: |
npm run coverage:create
case "$RUNNER_OS" in
Windows)
./codecov.exe --disable=gcov --token=${{ secrets.CODECOV_TOKEN }}
;;
Linux|macOS)
./codecov --disable=gcov --token=${{ secrets.CODECOV_TOKEN }}
;;
esac
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}