Update workflow #82
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
| name: Pull request | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| Lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install relevant dependencies | |
| run: | | |
| uv pip install "ruff>=0.9.0" --system | |
| - name: Check code formatting | |
| run: make check-format | |
| Check-MDN-Changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| mdn_changed: ${{ steps.check.outputs.mdn_changed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for MDN-related file changes | |
| id: check | |
| run: | | |
| # Get list of changed files in this PR | |
| CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) | |
| echo "Changed files:" | |
| echo "$CHANGED_FILES" | |
| # Check if any MDN-related files were changed | |
| if echo "$CHANGED_FILES" | grep -qE "(mdn|MDN)"; then | |
| echo "mdn_changed=true" >> $GITHUB_OUTPUT | |
| echo "MDN-related files were changed" | |
| else | |
| echo "mdn_changed=false" >> $GITHUB_OUTPUT | |
| echo "No MDN-related files were changed" | |
| fi | |
| Test: | |
| needs: Check-MDN-Changes | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest ] | |
| python-version: ["3.12", "3.14"] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install slim version | |
| run: | | |
| uv pip install -e "." --system | |
| - name: Install R and dependencies (Python 3.14 only) | |
| if: matrix.python-version == '3.14' | |
| run: | | |
| # Install R from CRAN repo (rpy2 requires R >= 4.5 for R_getVar symbol) | |
| wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/cran-archive-keyring.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/cran-archive-keyring.gpg] https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | sudo tee /etc/apt/sources.list.d/cran.list | |
| sudo apt-get update | |
| sudo apt-get install -y r-base r-base-dev libtirpc-dev | |
| - name: Install R packages (Python 3.14 only) | |
| if: matrix.python-version == '3.14' | |
| run: | | |
| sudo Rscript -e 'install.packages("StatMatch", repos="https://cloud.r-project.org")' | |
| sudo Rscript -e 'install.packages("clue", repos="https://cloud.r-project.org")' | |
| - name: Install full test dependencies without MDN (Python 3.14) | |
| if: matrix.python-version == '3.14' && needs.Check-MDN-Changes.outputs.mdn_changed != 'true' | |
| run: | | |
| uv pip install -e ".[dev,matching]" --system | |
| - name: Install full test dependencies with MDN (Python 3.14) | |
| if: matrix.python-version == '3.14' && needs.Check-MDN-Changes.outputs.mdn_changed == 'true' | |
| run: | | |
| uv pip install -e ".[dev,matching,mdn]" --system | |
| - name: Install minimal test dependencies (Python 3.12) | |
| if: matrix.python-version == '3.12' | |
| run: | | |
| uv pip install -e ".[dev]" --system | |
| - name: Run full tests with coverage (Python 3.14) | |
| if: matrix.python-version == '3.14' | |
| run: make test | |
| - name: Run smoke test only (Python 3.12) | |
| if: matrix.python-version == '3.12' | |
| run: | | |
| python -m pytest tests/test_smoke_qrf.py -v | |
| python -m pytest tests/test_basic.py -v | |
| - name: Run pipeline example | |
| if: matrix.python-version == '3.14' | |
| run: | | |
| python examples/pipeline.py | |
| - name: Upload microimputation results | |
| if: always() && matrix.python-version == '3.14' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: microimputation-results-${{ github.sha }} | |
| path: microimputation-dashboard/public/microimputation_results.csv | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| verbose: true |