Removed Python 3.8, added Python 3.13 and newer DB versions #133
This file contains hidden or 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
| # Workflow on push & pull request | |
| # * Check with flake8 | |
| # * Run tests in different environments | |
| # | |
| name: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - ".github/workflows/release.yml" | |
| - ".gitignore" | |
| - ".readthedocs.yaml" | |
| - "docs/**" | |
| - "*.rst" | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - ".github/workflows/release.yml" | |
| - ".gitignore" | |
| - ".readthedocs.yaml" | |
| - "docs/**" | |
| - "*.rst" | |
| workflow_dispatch: {} | |
| jobs: | |
| check: | |
| name: Flake8 Sanity Check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install flake8 | |
| run: | | |
| # Install flake8 | |
| pip install flake8 | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. | |
| flake8 . --count --exit-zero --statistics | |
| build_and_test: | |
| name: Run Unit Tests | |
| needs: | |
| - check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: | |
| # Test all currently supported versions | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| mysql: | |
| # Test currently supported LTS versions | |
| - "mysql-8.0" | |
| - "mysql-8.4" | |
| - "mariadb-10.5" | |
| - "mariadb-10.6" | |
| - "mariadb-10.11" | |
| - "mariadb-11.4" | |
| sqlalchemy: | |
| - "1.4" | |
| # Maintenance release | |
| - "2.0" | |
| # Current release | |
| # exclude: | |
| # - python: "3.9" | |
| # mysql: mysql-8.4 | |
| # - python: "3.9" | |
| # mysql: mariadb-10.11 | |
| # - python: "3.9" | |
| # mysql: mariadb-11.5 | |
| # - python: "3.10" | |
| # mysql: mariadb-10.5 | |
| # - python: "3.11" | |
| # mysql: mariadb-10.5 | |
| # - python: "3.11" | |
| # sqlalchemy: "1.4" | |
| # - python: "3.12" | |
| # mysql: mariadb-10.5 | |
| # - python: "3.12" | |
| # sqlalchemy: "1.4" | |
| # - python: "3.13" | |
| # mysql: mariadb-10.5 | |
| # - python: "3.13" | |
| # sqlalchemy: "1.4" | |
| steps: | |
| - name: Checkout Git repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up MySQL ${{ matrix.mysql }} | |
| uses: shogo82148/actions-setup-mysql@v1 | |
| with: | |
| mysql-version: ${{ matrix.mysql }} | |
| root-password: ${{ secrets.MYSQL_ROOT_PW }} | |
| # log_bin causes errors when creating procedures, | |
| # and we don't need replication. | |
| my-cnf: | | |
| disable_log_bin | |
| - name: Set up Python ${{ matrix.python }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install Python packages | |
| run: | | |
| # Install SQLAlchemy ${{ matrix.sqlalchemy }} | |
| pip install sqlalchemy~=${{ matrix.sqlalchemy }} | |
| # There seems to be no easy way to install dependencies | |
| # from pyproject.toml, so we just install the package... | |
| pip install -e .[mysql] | |
| pip install coverage[toml] | |
| - name: Prepare database | |
| run: | | |
| # Prepare the MySQL database | |
| mysql -v -u root -h 127.0.0.1 -p"${{ secrets.MYSQL_ROOT_PW }}" <<EOF | |
| CREATE DATABASE digikam; | |
| CREATE USER digikam@localhost IDENTIFIED BY '${{ secrets.MYSQL_USER_PW }}'; | |
| GRANT ALL PRIVILEGES ON digikam.* TO digikam@localhost; | |
| EOF | |
| - name: Prepare test configuration | |
| run: | | |
| # Generate test MySQL configuration | |
| cat >mysql_data.py <<EOF | |
| db_host = '127.0.0.1' | |
| db_user = 'digikam' | |
| db_pass = '${{ secrets.MYSQL_USER_PW }}' | |
| db_name = 'digikam' | |
| EOF | |
| - name: Test with Python unittest | |
| run: | | |
| # Run Python test | |
| coverage run -m unittest -v | |
| - name: Save Coverage Data | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-data_py-${{ matrix.python }}_${{ matrix.mysql }}_sqla-${{ matrix.sqlalchemy }} | |
| path: .coverage.* | |
| - name: Test log | |
| if: ${{ always() }} | |
| run: | | |
| # Show the test log | |
| cat test.log | |
| - name: System information for debugging | |
| if: ${{ failure() }} | |
| run: | | |
| # Show some system information | |
| echo "Disk devices" | |
| for d in /dev/root /dev/sd* /dev/nvme*; do | |
| test -e $d && ls -l $d | |
| done | |
| ls -l /dev/disk/by-uuid | |
| echo "Mounted devices" | |
| cat /proc/mounts | grep ^/dev/ | |
| coverage: | |
| name: Aggregate Test Coverage | |
| needs: | |
| - build_and_test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - name: Checkout Git repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| # coverage report needs _version.py, so install... | |
| pip install -e . | |
| pip install coverage[toml] | |
| - name: Load Coverage Data | |
| uses: actions/download-artifact@v4 | |
| - name: Aggregate Coverage Data | |
| run: | | |
| # Run coverage combine | |
| mkdir coverage-data | |
| cp coverage-data_*/.coverage.* coverage-data | |
| cd coverage-data | |
| coverage combine | |
| cp .coverage .. | |
| - name: Coverage report | |
| run: | | |
| # Run coverage report | |
| coverage report -m | |
| packaging_test: | |
| name: Test Packaging | |
| needs: | |
| - build_and_test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - name: Checkout Git repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Generate Packages | |
| run: | | |
| pip install build | |
| python -m build | |
| - name: Upload to test.pypi.org | |
| if: false | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| repository_url: https://test.pypi.org/legacy/ | |