fix: standardize handling of resources #8948
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
# Cancel concurrent flows on PRs | |
group: ci-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
formatting: | |
if: github.event.pull_request.merged != true || github.ref != 'refs/heads/main' | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Pixi | |
uses: prefix-dev/[email protected] | |
with: | |
environments: "quality" | |
pixi-version: v0.42.1 | |
cache: false # no pixi.lock | |
locked: false | |
- name: Run black | |
run: pixi run -e quality format --check --diff . | |
- name: Comment PR | |
if: github.event_name == 'pull_request' && failure() | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
message: "Please format your code with [black](https://black.readthedocs.io): `black snakemake tests/*.py`." | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
################################################################################################ | |
# Testing: Run tests using Pixi | |
################################################################################################ | |
tests: | |
if: github.event.pull_request.merged != true || github.ref != 'refs/heads/main' | |
strategy: | |
fail-fast: false | |
matrix: | |
test_group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
# see pyprojec.toml: [tool.pixi.feature.test] for available test types | |
os: [ubuntu-latest, windows-latest, macos-latest] # , macos-13 not supported yet | |
env: ["py311", "py312", "py313"] | |
exclude: | |
- os: windows-latest | |
env: "py311" | |
- os: macos-latest | |
env: "py311" | |
runs-on: ${{ matrix.os }} | |
env: | |
AWS_AVAILABLE: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
GCP_AVAILABLE: "${{ secrets.GCP_SA_KEY }}" | |
ZENODO_SANDBOX_PAT: "${{ secrets.ZENODO_SANDBOX_PAT }}" | |
CI: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Pixi | |
uses: prefix-dev/[email protected] | |
with: | |
environments: ${{ matrix.env }} | |
pixi-version: v0.42.1 | |
cache: false # no pixi.lock | |
locked: false | |
# See https://github.com/apptainer/apptainer/pull/2262 | |
- name: Disable apparmor namespace restrictions for apptainer (os='Linux') | |
if: runner.os == 'Linux' | |
run: | | |
sudo sh -c 'echo kernel.apparmor_restrict_unprivileged_userns=0 \ | |
>/etc/sysctl.d/90-disable-userns-restrictions.conf' | |
sudo sysctl -p /etc/sysctl.d/90-disable-userns-restrictions.conf | |
- name: Setup MinIO for AWS S3 testing (os='Linux', for AWS S3 testing) | |
if: runner.os == 'Linux' | |
uses: comfuture/minio-action@v1 | |
with: | |
access_key: minio | |
secret_key: minio123 | |
port: 9000 | |
- name: Test MinIO (os='Linux') | |
if: runner.os == 'Linux' | |
run: | | |
export AWS_ACCESS_KEY_ID=minio | |
export AWS_SECRET_ACCESS_KEY=minio123 | |
export AWS_EC2_METADATA_DISABLED=true | |
aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test | |
- name: Run Tests for Linux (os= 'Linux') | |
if: runner.os == 'Linux' | |
run: | | |
pixi run --environment ${{matrix.env}} test-all \ | |
--splits 10 \ | |
--group ${{ matrix.test_group }} \ | |
--splitting-algorithm=least_duration \ | |
--showlocals \ | |
--show-capture=all | |
cd tests/test_report | |
pixi run -e ${{ matrix.env }} snakemake \ | |
--use-conda \ | |
--cores 1 \ | |
--report report.zip | |
- name: Run Tests for MacOS (os='macOS') | |
if: runner.os == 'macOS' | |
run: | | |
pixi run --environment ${{matrix.env}} test-simple \ | |
--splits 10 \ | |
--group ${{ matrix.test_group }} \ | |
--splitting-algorithm=least_duration \ | |
--showlocals \ | |
--show-capture=all | |
- name: Run Tests for Windows (os='Windows') | |
if: runner.os == 'Windows' | |
run: | | |
pixi run --environment ${{matrix.env}} test-simple --splits 10 --group ${{ matrix.test_group }} --splitting-algorithm=least_duration --showlocals --show-capture=all | |
build-container-image: | |
if: github.event.pull_request.merged != true || github.ref != 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build container image | |
run: docker build . | |
testing-done: | |
if: github.event.pull_request.merged != true || github.ref != 'refs/heads/main' | |
needs: | |
- tests | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "All tests passed." |