Skip to content

CI on pull request #265

CI on pull request

CI on pull request #265

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:
name: Lint and check formatting
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", "3.12"]
singularity: [
{provider: "singularity", version: "3.8.7"},
{provider: "apptainer", version: "1.1.3"},
{provider: "apptainer", version: "1.3.4"},
{provider: "singularity-ce", version: "3.9.2"},
{provider: "singularity-ce", version: "4.1.3"},
{provider: "singularity-ce", version: "4.2.1"}
]
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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.singularity.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@v5
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/*