Try fixing mamba in CI, pt 3 #78
This file contains 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
# ================================================================================================== | |
# Header | |
# ================================================================================================== | |
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- dev | |
# ================================================================================================== | |
# Jobs | |
# ================================================================================================== | |
jobs: | |
# ========================================================================== | |
# test | |
# ========================================================================== | |
test: | |
# if: ${{ false }} # disable for now | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
# Need to specify the shell explicitly. | |
# https://github.com/marketplace/actions/setup-miniconda#important | |
# https://github.com/conda-incubator/setup-miniconda#use-a-default-shell | |
shell: bash -el {0} | |
# ------------------------------------------------------- | |
# Matrix | |
# ------------------------------------------------------- | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
# - macos-latest | |
# - ubuntu-22.04 | |
# - ubuntu-20.04 | |
# - macos-12 | |
# - macos-11 | |
# Test cases as listed in test/cases/*.txt | |
# We update them automatically when running the test/run.sh script, so that each time | |
# we have and run a new test case, it also appears here. The script to run this update | |
# is located in .github/workflows/update-cases.sh | |
case: | |
# CASES_BEGIN | |
- base | |
- calling-bcftools-1 | |
- calling-bcftools-2 | |
- calling-bcftools-3 | |
- calling-bcftools-4 | |
- calling-freebayes-1 | |
- calling-freebayes-2 | |
- calling-freebayes-3 | |
- calling-haplotypecaller-1 | |
- calling-haplotypecaller-2 | |
- calling-haplotypecaller-3 | |
- calling-haplotypecaller-4 | |
- duplicates-dedup-1 | |
- duplicates-dedup-2 | |
- hafpipe-1 | |
- hafpipe-2 | |
- hafpipe-3 | |
- hafpipe-4 | |
- mapping-bowtie2-1 | |
- mapping-bowtie2-2 | |
- mapping-bwaaln-1 | |
- mapping-bwaaln-2 | |
- mapping-bwaaln-3 | |
- mapping-bwaaln-4 | |
- mapping-bwa-mem-1 | |
- mapping-bwa-mem2-1 | |
- mapping-bwa-mem2-2 | |
- pileup-1 | |
- trimming-adapterremoval-1 | |
- trimming-adapterremoval-2 | |
- trimming-adapterremoval-3 | |
- trimming-cutadapt-1 | |
- trimming-cutadapt-2 | |
- trimming-fastp-1 | |
- trimming-fastp-2 | |
- trimming-fastp-3 | |
- trimming-seqprep-1 | |
- trimming-seqprep-2 | |
- trimming-skewer-1 | |
- trimming-skewer-2 | |
# CASES_END | |
installer: | |
# - conda | |
- mamba | |
include: | |
# Also test with other operating systems. | |
# For now, we just test the base case to see if it's generally working. | |
# This repeats one of the Ubuntu runs for the base case, but that's okay | |
# to keep it future proof when the default ubuntu-latest changes. | |
- os: ubuntu-22.04 | |
case: base | |
- os: ubuntu-20.04 | |
case: base | |
- os: macos-12 | |
case: base | |
- os: macos-11 | |
case: base | |
# ------------------------------------------------------- | |
# Steps | |
# ------------------------------------------------------- | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v3.0.3 | |
with: | |
# We need mamba here already, otherwise we run into | |
# https://github.com/conda-incubator/setup-miniconda/issues/262 | |
mamba-version: "*" | |
channels: conda-forge | |
# We need to replace the above, at least for now, due to instabilities in the action, | |
# see https://github.com/conda-incubator/setup-miniconda/issues/274#issue-1531425010 | |
# If that changes again in the future, also change it below in the other jobs. | |
# miniforge-variant: Mambaforge | |
# miniforge-version: latest | |
environment-file: envs/grenepipe.yaml | |
activate-environment: grenepipe | |
# Manually create the conda env. | |
# Not needed at the moment, as the above setup works fine. Keeping this here for reference. | |
# - name: Install Conda Env | |
# shell: bash -el {0} | |
# run: | | |
# mamba env create -f envs/grenepipe.yaml -n grenepipe | |
# Then in the run step: | |
# conda activate grenepipe | |
# Run the test case. | |
- name: Run Test | |
run: | | |
if [[ "${{ matrix.installer }}" == "conda" ]]; then | |
export GRENEPIPE_TESTS_NO_MAMBA=1 | |
fi | |
./test/run.sh ${{ matrix.case }} | |
# Store a list of all files and sizes, for debugging. | |
- name: File Inventory | |
if: always() | |
run: | | |
mkdir -p test/out-${{ matrix.case }}/logs | |
ls -alFR test/out-${{ matrix.case }} > test/out-${{ matrix.case }}/logs/files.txt | |
ls -alFR test/reference >> test/out-${{ matrix.case }}/logs/files.txt | |
# Upload the log files as a GitHub Actions artifact | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs-test-${{ matrix.os }}-${{ matrix.case }} | |
path: | | |
test/out-${{ matrix.case }}/test-run.log | |
test/out-${{ matrix.case }}/logs/ | |
test/out-${{ matrix.case }}/.snakemake/log/ | |
test/reference/logs/ | |
test/reference/TAIR10_chr_all.dict | |
# ========================================================================== | |
# example | |
# ========================================================================== | |
example: | |
# if: ${{ false }} # disable for now | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
# ------------------------------------------------------- | |
# Matrix | |
# ------------------------------------------------------- | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- macos-12 | |
- macos-11 | |
# ------------------------------------------------------- | |
# Steps | |
# ------------------------------------------------------- | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v3.0.3 | |
with: | |
mamba-version: "*" | |
channels: conda-forge | |
# Need to use a different setup to get mamba to work, see above. | |
# miniforge-variant: Mambaforge | |
# miniforge-version: latest | |
environment-file: envs/grenepipe.yaml | |
activate-environment: grenepipe | |
- name: Run Example | |
run: | | |
./example/prepare.sh | |
snakemake --use-conda --conda-frontend mamba --cores 4 --directory example/ 2>&1 | tee example/run.log | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs-example-${{ matrix.os }} | |
path: | | |
example/run.log | |
example/logs/ | |
example/.snakemake/log/ | |
# ========================================================================== | |
# envs | |
# ========================================================================== | |
envs: | |
# if: ${{ false }} # disable for now | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
# ------------------------------------------------------- | |
# Matrix | |
# ------------------------------------------------------- | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- macos-12 | |
- macos-11 | |
installer: | |
# Conda is just waaaay to slow... some runs even exceed the GitHub Actions | |
# max runtime of 6h, so we have to deactivate it for now. | |
# - conda | |
- mamba | |
# ------------------------------------------------------- | |
# Steps | |
# ------------------------------------------------------- | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v3.0.3 | |
with: | |
mamba-version: "*" | |
channels: conda-forge | |
# Need to use a different setup now to get mamba to work, see above. | |
# miniforge-variant: Mambaforge | |
# miniforge-version: latest | |
environment-file: envs/grenepipe.yaml | |
activate-environment: grenepipe | |
- name: Install Envs | |
run: | | |
cd envs | |
for env in `ls *.yaml` ; do | |
name=${env%.yaml} | |
printf "\n" ; printf '=%.0s' {1..100} | |
printf "\n ${name}\n" | |
printf '=%.0s' {1..100} ; printf "\n\n" | |
if [[ "$name" = "grenepipe" ]]; then | |
echo "Skipping grenepipe" | |
continue | |
fi | |
if [[ ${{ matrix.os }} == macos* ]] && [[ "${name}" == *-linux ]]; then | |
echo "Skipping linux env on macos" | |
continue | |
fi | |
if [[ ${{ matrix.os }} == ubuntu* ]] && [[ "${name}" == *-macos ]]; then | |
echo "Skipping macos env on linux" | |
continue | |
fi | |
${{ matrix.installer }} env create -f ${env} -n ${name} | |
done |