mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-12 02:33:58 +00:00
Before that the gettext command shipping with git for Windows were used. Since git 2.44.0 these are no longer bundled. # Conflicts: # .github/workflows/package-pypi.yml # .github/workflows/package-windows.yml
148 lines
4.6 KiB
YAML
148 lines
4.6 KiB
YAML
name: Run tests
|
|
|
|
on: [push, pull_request]
|
|
permissions: {}
|
|
|
|
jobs:
|
|
test-latest:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest, ubuntu-latest, windows-2019]
|
|
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
|
|
include:
|
|
- os: macos-11
|
|
python-version: '3.7'
|
|
env:
|
|
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
|
|
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 dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --upgrade setuptools
|
|
pip install -r requirements.txt
|
|
- name: Install gettext (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install gettext
|
|
- name: Install gettext (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install gettext
|
|
brew link gettext --force
|
|
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
|
|
- name: Check coding style
|
|
run: |
|
|
pip install flake8 "isort>=5"
|
|
flake8 picard test --count --show-source --statistics
|
|
isort --check-only --diff --recursive picard test
|
|
- name: Test with pytest
|
|
if: always()
|
|
timeout-minutes: 30
|
|
run: |
|
|
python setup.py build_locales -i
|
|
pip install pytest pytest-randomly pytest-cov
|
|
pytest --verbose --cov=picard --cov-report xml:coverage.xml test
|
|
- name: Test python-libdiscid (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install libdiscid-dev
|
|
python -c "from picard.disc import discid_version; print(discid_version)"
|
|
pytest --verbose test/test_disc.py
|
|
pip install python-libdiscid
|
|
python -c "from picard.disc import discid_version; print(discid_version)"
|
|
pytest --verbose test/test_disc.py
|
|
- name: Submit code coverage to Codacy
|
|
if: env.CODACY_PROJECT_TOKEN
|
|
run: |
|
|
pip install codacy-coverage
|
|
python-codacy-coverage -r coverage.xml
|
|
|
|
test-requirements:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ['3.7']
|
|
dependencies: [
|
|
"PyQt5==5.14.2",
|
|
"PyQt5==5.13.2",
|
|
"PyQt5==5.12.3",
|
|
"PyQt5==5.11.3 sip==4.19.8 mutagen==1.37",
|
|
]
|
|
|
|
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 dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install $DEPENDENCIES
|
|
pip install -r requirements.txt
|
|
env:
|
|
DEPENDENCIES: ${{ matrix.dependencies }}
|
|
- name: Test with pytest
|
|
timeout-minutes: 30
|
|
run: |
|
|
pip install pytest pytest-randomly pytest-cov
|
|
pytest --verbose test
|
|
|
|
pip-install: # Test whether a clean pip install from source works
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
python-version: ['3.8', '3.11']
|
|
|
|
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 gettext (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install gettext
|
|
- name: Install gettext (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install gettext
|
|
brew link gettext --force
|
|
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
|
|
- name: Install gettext (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
& .\scripts\package\win-setup-gettext.ps1 `
|
|
-GettextVersion $Env:GETTEXT_VERSION -GettextSha256Sum $Env:GETTEXT_SHA256SUM
|
|
Add-Content $env:GITHUB_PATH (Join-Path -Path (Resolve-Path .) -ChildPath gettext\bin)
|
|
env:
|
|
GETTEXT_VERSION: 0.22.4
|
|
GETTEXT_SHA256SUM: 220068ac0b9e7aedda03534a3088e584640ac1e639800b3a0baa9410aa6d012a
|
|
- name: Run pip install .
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install .
|
|
- name: Test running installed package
|
|
if: runner.os != 'Windows'
|
|
run: picard --long-version --no-crash-dialog
|
|
- name: Verify sdist package
|
|
if: runner.os != 'Windows'
|
|
timeout-minutes: 30
|
|
run: |
|
|
pip install --upgrade setuptools
|
|
pip install pytest
|
|
scripts/package/run-sdist-test.sh
|