Skip to content

Linting and formatting with Ruff #215

Linting and formatting with Ruff

Linting and formatting with Ruff #215

Workflow file for this run

name: CI on pull request
on:
pull_request:
branches:
- main
schedule:
- cron: '15 2 * * TUE' # Also run the full test suite for PRs on the main branch every Tuesday night
jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
run-full-test-suite:
name: Run full test suite
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
singularity-provider: ["singularity", "apptainer", "singularity-ce"]
include:
- singularity-provider: "singularity"
singularity-version: "3.8.7"
- singularity-provider: "apptainer"
singularity-version: "1.1.3"
- singularity-provider: "singularity-ce"
singularity-version: "3.9.2"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Attempt to restore Singularity/Apptainer installer from cache
uses: actions/cache@v3
id: cache-singularity-installer
with:
path: ./singularity_installer.deb
key: ${{ matrix.os }}-${{ matrix.singularity-provider }}_installer-${{ matrix.singularity-version }}
- name: Download Singularity ${{ matrix.singularity-version }}
if: ${{ steps.cache-singularity-installer.outputs.cache-hit != 'true' && matrix.singularity-provider == 'singularity' }}
run: wget -O singularity_installer.deb https://github.com/apptainer/singularity/releases/download/v${{ matrix.singularity-version }}/singularity-container_${{ matrix.singularity-version }}_amd64.deb
- name: Download Apptainer ${{ matrix.apptainer-version }}
if: ${{ steps.cache-singularity-installer.outputs.cache-hit != 'true' && matrix.singularity-provider == 'apptainer' }}
run: wget -O singularity_installer.deb https://github.com/apptainer/apptainer/releases/download/v${{ matrix.singularity-version }}/apptainer_${{ matrix.singularity-version }}_amd64.deb
- name: Download SingularityCE ${{ matrix.singularity-version }}
if: ${{ steps.cache-singularity-installer.outputs.cache-hit != 'true' && matrix.singularity-provider == 'singularity-ce' }}
run: wget -O singularity_installer.deb https://github.com/sylabs/singularity/releases/download/v${{ matrix.singularity-version }}/singularity-ce_${{ matrix.singularity-version }}-focal_amd64.deb
- name: Set up Singularity/Apptainer
run: |
sudo apt install ./singularity_installer.deb
singularity --version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: "**/test-requirements.txt"
- name: Install test dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r test-requirements.txt
- name: Run test suite via pytest
run: pytest -vv --junitxml=pytest_junit_out.xml
- name: Archive the test results and coverage
uses: actions/upload-artifact@v3
with:
name: test-results-and-coverage_python${{ matrix.python-version }}_${{ matrix.singularity-provider }}${{ matrix.singularity-version }}
path: |
pytest_junit_out.xml
htmlcov/*