Skip to content

⬆️ Bump codecov/codecov-action from 4 to 5 #244

⬆️ Bump codecov/codecov-action from 4 to 5

⬆️ Bump codecov/codecov-action from 4 to 5 #244

Workflow file for this run

name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_call:
defaults:
run:
shell: bash
permissions: read-all
jobs:
analyze:
name: "Analyze"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Run static analysis
run: tox -e linters
test:
name: "Test"
needs: analyze
runs-on: ubuntu-latest
strategy:
matrix:
include:
- toxenv: "python3.8"
db: "mariadb:5.5"
legacy_db: 1
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:5.5"
legacy_db: 1
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:5.5"
legacy_db: 1
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:5.5"
legacy_db: 1
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:5.5"
legacy_db: 1
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.0"
legacy_db: 1
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.0"
legacy_db: 1
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.0"
legacy_db: 1
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.0"
legacy_db: 1
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.0"
legacy_db: 1
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.1"
legacy_db: 1
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.1"
legacy_db: 1
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.1"
legacy_db: 1
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.1"
legacy_db: 1
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.1"
legacy_db: 1
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.2"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.2"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.2"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.2"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.2"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.3"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.3"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.3"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.3"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.3"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.4"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.4"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.4"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.4"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.4"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.5"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.5"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.5"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.5"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.5"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.6"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.6"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.6"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.6"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.6"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:10.11"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:10.11"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:10.11"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:10.11"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:10.11"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mariadb:11.4"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mariadb:11.4"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mariadb:11.4"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mariadb:11.4"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mariadb:11.4"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mysql:5.5"
legacy_db: 1
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mysql:5.5"
legacy_db: 1
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mysql:5.5"
legacy_db: 1
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mysql:5.5"
legacy_db: 1
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mysql:5.5"
legacy_db: 1
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mysql:5.6"
legacy_db: 1
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mysql:5.6"
legacy_db: 1
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mysql:5.6"
legacy_db: 1
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mysql:5.6"
legacy_db: 1
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mysql:5.6"
legacy_db: 1
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mysql:5.7"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mysql:5.7"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mysql:5.7"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mysql:5.7"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mysql:5.7"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mysql:8.0"
legacy_db: 0
experimental: false
py: "3.8"
- toxenv: "python3.9"
db: "mysql:8.0"
legacy_db: 0
experimental: false
py: "3.9"
- toxenv: "python3.10"
db: "mysql:8.0"
legacy_db: 0
experimental: false
py: "3.10"
- toxenv: "python3.11"
db: "mysql:8.0"
legacy_db: 0
experimental: false
py: "3.11"
- toxenv: "python3.12"
db: "mysql:8.0"
legacy_db: 0
experimental: false
py: "3.12"
- toxenv: "python3.8"
db: "mysql:8.4"
legacy_db: 0
experimental: true
py: "3.8"
- toxenv: "python3.9"
db: "mysql:8.4"
legacy_db: 0
experimental: true
py: "3.9"
- toxenv: "python3.10"
db: "mysql:8.4"
legacy_db: 0
experimental: true
py: "3.10"
- toxenv: "python3.11"
db: "mysql:8.4"
legacy_db: 0
experimental: true
py: "3.11"
- toxenv: "python3.12"
db: "mysql:8.4"
legacy_db: 0
experimental: true
py: "3.12"
continue-on-error: ${{ matrix.experimental }}
services:
mysql:
image: ${{ matrix.db }}
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: >-
--name=mysqld
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-1
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
set -e
python -m pip install --upgrade pip
python -m pip install -U codecov tox-gh-actions
pip install -r requirements_dev.txt
- name: Set up MySQL
env:
DB: ${{ matrix.db }}
MYSQL_USER: tester
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: test_db
MYSQL_HOST: 0.0.0.0
MYSQL_PORT: 3306
run: |
set -e
while :
do
sleep 1
mysql -h127.0.0.1 -uroot -e 'select version()' && break
done
case "$DB" in
'mysql:8.0'|'mysql:8.4')
mysql -h127.0.0.1 -uroot -e "SET GLOBAL local_infile=on"
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"
;;
esac
USER_CREATION_COMMANDS=''
WITH_PLUGIN=''
if [ "$DB" == 'mysql:8.0' ]; then
WITH_PLUGIN='with mysql_native_password'
USER_CREATION_COMMANDS='
CREATE USER
user_sha256 IDENTIFIED WITH "sha256_password" BY "pass_sha256",
nopass_sha256 IDENTIFIED WITH "sha256_password",
user_caching_sha2 IDENTIFIED WITH "caching_sha2_password" BY "pass_caching_sha2",
nopass_caching_sha2 IDENTIFIED WITH "caching_sha2_password"
PASSWORD EXPIRE NEVER;
GRANT RELOAD ON *.* TO user_caching_sha2;'
elif [ "$DB" == 'mysql:8.4' ]; then
WITH_PLUGIN='with caching_sha2_password'
USER_CREATION_COMMANDS='
CREATE USER
user_caching_sha2 IDENTIFIED WITH "caching_sha2_password" BY "pass_caching_sha2",
nopass_caching_sha2 IDENTIFIED WITH "caching_sha2_password"
PASSWORD EXPIRE NEVER;
GRANT RELOAD ON *.* TO user_caching_sha2;'
fi
if [ ! -z "$USER_CREATION_COMMANDS" ]; then
mysql -uroot -h127.0.0.1 -e "$USER_CREATION_COMMANDS"
fi
mysql -h127.0.0.1 -uroot -e "create database $MYSQL_DATABASE DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
mysql -h127.0.0.1 -uroot -e "create user $MYSQL_USER identified $WITH_PLUGIN by '${MYSQL_PASSWORD}'; grant all on ${MYSQL_DATABASE}.* to ${MYSQL_USER};"
mysql -h127.0.0.1 -uroot -e "create user ${MYSQL_USER}@localhost identified $WITH_PLUGIN by '${MYSQL_PASSWORD}'; grant all on ${MYSQL_DATABASE}.* to ${MYSQL_USER}@localhost;"
- name: Create db_credentials.json
env:
MYSQL_USER: tester
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: test_db
MYSQL_HOST: 0.0.0.0
MYSQL_PORT: 3306
run: |
set -e
jq -n \
--arg mysql_user "$MYSQL_USER" \
--arg mysql_password "$MYSQL_PASSWORD" \
--arg mysql_database "$MYSQL_DATABASE" \
--arg mysql_host "$MYSQL_HOST" \
--arg mysql_port $MYSQL_PORT \
'$ARGS.named' > tests/db_credentials.json
- name: Test with tox
env:
LEGACY_DB: ${{ matrix.legacy_db }}
run: tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: techouse/mysql-to-sqlite3
files: ./coverage.xml
env_vars: OS,PYTHON
verbose: true
- name: Cleanup
if: ${{ always() }}
run: |
rm -rf tests/db_credentials.json