⬆️ Bump docker/build-push-action from 5 to 6 #273
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
needs: analyze | |
name: "Test" | |
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: "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" | |
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: | | |
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 | |
if [ "$DB" == 'mysql:8.0' ]; then | |
WITH_PLUGIN='with mysql_native_password' | |
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}" | |
mysql -uroot -h127.0.0.1 -e ' | |
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;' | |
mysql -uroot -h127.0.0.1 -e 'GRANT RELOAD ON *.* TO user_caching_sha2;' | |
else | |
WITH_PLUGIN='' | |
fi | |
mysql -h127.0.0.1 -uroot -e "create database $MYSQL_DATABASE DEFAULT CHARACTER SET utf8mb4" | |
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@v4 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: techouse/sqlite3-to-mysql | |
files: ./coverage.xml | |
env_vars: OS,PYTHON | |
verbose: true | |
- name: Cleanup | |
if: ${{ always() }} | |
run: | | |
rm -rf tests/db_credentials.json |