Skip to content

feat: allow python expressions in --set-resources #5678

feat: allow python expressions in --set-resources

feat: allow python expressions in --set-resources #5678

Workflow file for this run

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:
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
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: black
create-args: black
cache-environment: true
- name: Check formatting
shell: bash -el {0}
run: black --check --diff .
- name: Comment PR
if: github.event_name == 'pull_request' && failure()
uses: marocchino/sticky-pull-request-comment@v2.8.0
with:
message: "Please format your code with [black](https://black.readthedocs.io): `black snakemake tests/*.py`."
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
testing:
strategy:
matrix:
test_group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
py_ver: ["3.11", "3.12"]
runs-on: ubuntu-latest
needs: formatting
env:
AWS_AVAILABLE: "${{ secrets.AWS_ACCESS_KEY_ID }}"
GCP_AVAILABLE: "${{ secrets.GCP_SA_KEY }}"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Modify python version in test env
shell: bash -el {0}
run: |
cp test-environment.yml test-environment-${{ matrix.py_ver }}.yml
sed -E -i 's/- python.+/- python =${{ matrix.py_ver }}/' test-environment-${{ matrix.py_ver }}.yml
- name: Setup snakemke environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: test-environment-${{ matrix.py_ver }}.yml
environment-name: snakemake
cache-environment: true
- name: Install snakemake from source
shell: bash -el {0}
run: |
conda config --set channel_priority strict
# TODO remove and add as regular dependency once released
pip install git+https://github.com/snakemake/snakemake-interface-common.git
pip install git+https://github.com/snakemake/snakemake-interface-executor-plugins.git
pip install git+https://github.com/snakemake/snakemake-executor-plugin-cluster-generic.git
pip install git+https://github.com/snakemake/snakemake-interface-storage-plugins.git
pip install git+https://github.com/snakemake/snakemake-storage-plugin-http.git
pip install git+https://github.com/snakemake/snakemake-storage-plugin-s3.git
pip install -e .
- name: Configure fast APT mirror
uses: vegardit/fast-apt-mirror.sh@1.0.0
- name: Setup apt dependencies
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt-get update
sudo apt install -y stress git wget openmpi-bin libopenmpi-dev apptainer
- name: Test local
env:
CI: true
ZENODO_SANDBOX_PAT: "${{ secrets.ZENODO_SANDBOX_PAT }}"
#PYTHONTRACEMALLOC: 10
shell: bash -el {0}
run: |
pytest -v -x --show-capture=stderr \
--splits 10 --group ${{ matrix.test_group }} --splitting-algorithm=least_duration \
tests/tests.py \
tests/test_expand.py \
tests/test_io.py \
tests/test_schema.py \
tests/test_linting.py \
tests/test_executor_test_suite.py \
tests/test_api.py
build-container-image:
runs-on: ubuntu-latest
needs: testing
steps:
- uses: actions/checkout@v4
- name: Build container image
run: docker build .
testing-windows:
strategy:
matrix:
test_group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
runs-on: windows-latest
needs: formatting
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Remove unix-only dependencies
shell: python
run: |
import fileinput
excluded_on_win = ["environment-modules", "cwltool", "cwl-utils", "apptainer", "squashfuse"]
for line in fileinput.input("test-environment.yml", inplace=True):
if " - pip:" in line:
break
if all(pkg not in line for pkg in excluded_on_win):
print(line, end="")
- name: Setup snakemke environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: test-environment.yml
environment-name: snakemake
init-shell: powershell
cache-environment: true
- name: Install snakemake from source
run: |
# TODO remove and add as regular dependency once released
pip install git+https://github.com/snakemake/snakemake-interface-common.git
pip install git+https://github.com/snakemake/snakemake-interface-executor-plugins.git
pip install git+https://github.com/snakemake/snakemake-executor-plugin-cluster-generic.git
pip install git+https://github.com/snakemake/snakemake-interface-storage-plugins.git
pip install git+https://github.com/snakemake/snakemake-storage-plugin-http.git
pip install git+https://github.com/snakemake/snakemake-storage-plugin-s3.git
pip install .
- name: Run tests
env:
CI: true
ZENODO_SANDBOX_PAT: "${{ secrets.ZENODO_SANDBOX_PAT }}"
run: |
python -m pytest --show-capture=stderr -v -x --splits 10 --group ${{ matrix.test_group }} --splitting-algorithm=least_duration tests/tests.py