Skip to content

feat: implement precommand (#2482) #18

feat: implement precommand (#2482)

feat: implement precommand (#2482) #18

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches_ignore: []
jobs:
cancel-previous:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: khan/pull-request-workflow-cancel@1.0.1
with:
workflows: main.yml
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
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@v3
- name: Setup black environment
run: |
conda create -c conda-forge -y -q --name black black
- name: Check formatting
run: >
export PATH="/usr/share/miniconda/bin:$PATH"
source activate black
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]
runs-on: ubuntu-latest
needs: formatting
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- "8888:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
AWS_AVAILABLE: "${{ secrets.AWS_ACCESS_KEY_ID }}"
GCP_AVAILABLE: "${{ secrets.GCP_SA_KEY }}"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup mamba
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: snakemake
channels: "conda-forge, bioconda"
miniforge-variant: Mambaforge
miniforge-version: latest
- name: Setup Snakemake environment
shell: bash -el {0}
run: |
conda config --set channel_priority strict
mamba env update -q -n snakemake --file test-environment.yml
# 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 .
# additionally add singularity (not necessary anymore, included in the test env now)
# TODO remove version constraint: needed because 3.8.7 fails with missing libz:
# bin/unsquashfs: error while loading shared libraries: libz.so.1:
# cannot open shared object file: No such file or directory
# mamba install -n snakemake "singularity<=3.8.6"
- name: Setup apt dependencies
run: |
sudo gem install apt-spy2
sudo apt-spy2 fix --commit --launchpad --country=US
sudo apt-get update
sudo apt install -y stress git wget openmpi-bin libopenmpi-dev mariadb-server
- name: Test local
env:
CI: true
ZENODO_SANDBOX_PAT: "${{ secrets.ZENODO_SANDBOX_PAT }}"
#PYTHONTRACEMALLOC: 10
shell: bash -el {0}
run: |
# long tests
pytest --show-capture=stderr --splits 10 --group ${{ matrix.test_group }} -v -x tests/tests.py
# other tests
pytest --show-capture=stderr -v -x tests/test_expand.py tests/test_io.py tests/test_schema.py tests/test_linting.py tests/test_executor_test_suite.py
build-container-image:
runs-on: ubuntu-latest
needs: testing
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- 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 all(pkg not in line for pkg in excluded_on_win):
print(line)
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: snakemake
channels: "conda-forge, bioconda"
miniforge-variant: Mambaforge
miniforge-version: latest
- name: Setup Snakemake environment
run: |
conda config --set channel_priority strict
mamba env update -q --file test-environment.yml
# 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: 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 }} tests/tests.py