Skip to content

Update pytest.yml #2529

Update pytest.yml

Update pytest.yml #2529

Workflow file for this run

---
name: Test and lint
on:
push:
merge_group:
schedule:
- cron: '0 10 * * 2'
#pull_request:
workflow_dispatch:
repository_dispatch:
types: [trigger_checks]
jobs:
pre-commit:
runs-on: macos-14
env:
RUFF_OUTPUT_FORMAT: 'github'
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip uv
uv pip install --system -r requirements.txt
- uses: pre-commit/action@v3.0.1
lint:
name: Lint (ruff, mypy, pylint)
runs-on: macos-14
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip uv
uv pip install --system --upgrade pylint mypy ruff
uv pip install --system -r requirements.txt
- name: Run Ruff
run: ruff check --output-format=github --exit-non-zero-on-fix .
- name: Run Ruff Format
run: ruff format --diff .
- name: Run mypy
run: |
mypy --install-types --non-interactive
- name: Run pylint
run: |
pylint --output-format=github artistools
superlinter:
name: Super linter
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Lint Code Base
uses: github/super-linter/slim@v5
env:
LINTER_RULES_PATH: ./
LOG_LEVEL: WARN
VALIDATE_GITHUB_ACTIONS: false
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
VALIDATE_PYTHON_BLACK: false
VALIDATE_PYTHON_FLAKE8: false
VALIDATE_PYTHON_ISORT: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_PYTHON_MYPY: false
YAML_ERROR_ON_WARNING: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pytest:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14]
python-version: ['3.10', '3.11', '3.12']
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
name: pytest python${{ matrix.python-version }}
steps:
- name: Checkout Code
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 uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install artistools
run: |
uv pip install --system --upgrade --compile-bytecode --editable .
- name: Cache test data
uses: actions/cache@v4
with:
path: tests/data/*.tar.xz
key: testdata20231114
- name: Download/extract test data
working-directory: tests/data/
run: source ./setuptestdata.sh
- name: Check artistools command line tool
run: |
artistools --help
artistools completions
- name: Test with pytest
run: |
pytest --cov=./ --cov-report=xml
- name: Report coverage
run: |
coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
# path_to_write_report: ./coverage/codecov_report.txt
verbose: true
codspeed-benchmarks:
timeout-minutes: 180
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.12']
env:
PYTHON: ${{ matrix.python-version }}
name: codspeed benchmarks python${{ matrix.python-version }}
steps:
- name: Checkout Code
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 uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install artistools
run: |
uv pip install --system --upgrade --compile-bytecode --editable .
- name: Cache test data
uses: actions/cache@v4
with:
path: tests/data/*.tar.xz
key: testdata20231114
- name: Download/extract test data
working-directory: tests/data/
run: source ./setuptestdata.sh
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest --codspeed