diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bb0af1..a10425d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,45 +4,66 @@ on: push: branches: - master - - 'development-*' # add pattern for development branches + - 'development-*' pull_request: branches: - master - - 'development-*' # allow PRs targeting development-* branches + - 'development-*' +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash # Use bash on all runners (incl. Windows) jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Check out source - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install project + dev deps - run: | - python -m pip install --upgrade pip - pip install -e ".[dev]" - - - name: Check formatting with Black - run: black --check . - - - name: Lint with Ruff - run: ruff check . - - - name: Run tests script - run: ./tests/run-tests.sh - - - name: Check .tests/*.txt not modified - run: | - # Fail if there are changes in .tests/*.txt - if ! git diff --exit-code -- .tests/*.txt; then - echo "::error::.tests/*.txt changed after running tests." - exit 1 - fi - - name: Run unit tests with coverage - run: pytest --cov=arib --cov-report=term-missing + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] # add macOS later if needed (costs 10× minutes) + python-version: ["3.10"] # expand to ["3.10","3.11","3.12"] if you want + runs-on: ${{ matrix.os }} + + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix['python-version'] }} + cache: 'pip' + cache-dependency-path: | + requirements*.txt + pyproject.toml + setup.cfg + setup.py + + - name: Install project + dev deps + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Check formatting with Black + run: black --check . + + - name: Lint with Ruff + run: ruff check . + + # If your ./tests/run-tests.sh is bash-friendly, this works cross-OS: + - name: Run tests script + run: bash ./tests/run-tests.sh + + - name: Check .tests/*.txt not modified + run: | + # Fail if there are changes in .tests/*.txt + if ! git diff --exit-code -- .tests/*.txt; then + echo "::error::.tests/*.txt changed after running tests." + exit 1 + fi + + - name: Run unit tests with coverage + run: pytest --cov=arib --cov-report=term-missing