Skip to content

Commit

Permalink
[INFRA] Try mamba
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Apr 19, 2024
1 parent 01faf9c commit 22cedb8
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 59 deletions.
27 changes: 8 additions & 19 deletions .github/vercel/0_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@
# SPDX-FileCopyrightText: 2016-2024, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

set -euxo pipefail
set -euo pipefail

WORK_DIR=`pwd`
CACHE_DIR="${WORK_DIR}/node_modules" # The node_modules directory is always cached.
FILE="Miniforge3-$(uname)-$(uname -m).sh"
curl -LsO "https://github.com/conda-forge/miniforge/releases/latest/download/${FILE}"
chmod +x ${FILE}
./${FILE} -b
rm -rf ${FILE}

mkdir -p ${CACHE_DIR}/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o ${CACHE_DIR}/miniconda3/miniconda.sh
chmod +x ${CACHE_DIR}/miniconda3/miniconda.sh
${CACHE_DIR}/miniconda3/miniconda.sh -b -u -p ${CACHE_DIR}/miniconda3
rm -rf ${CACHE_DIR}/miniconda3/miniconda.sh

${CACHE_DIR}/miniconda3/bin/conda init bash

set +x
source ~/.bashrc
set -x

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
conda config --set channel_priority strict

conda install --quiet --yes snakemake zstd wget mamba
mamba config --set default_threads 4
mamba install --quiet --yes snakemake -c bioconda
14 changes: 5 additions & 9 deletions .github/vercel/1_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
# SPDX-FileCopyrightText: 2016-2024, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

set -euxo pipefail
set -euo pipefail

set +x
source ~/.bashrc
conda activate
set -x
mamba activate

export WORK_DIR=`pwd`
mkdir -p results
zstd --decompress .github/data/data.tar.zst -c | tar xf - -C results

mkdir -p ${WORK_DIR}/results
zstd --decompress ${WORK_DIR}/.github/data/data.tar.zst -c | tar xf - -C ${WORK_DIR}/results

snakemake --use-conda --cores 2
snakemake --use-conda --conda-frontend mamba --cores 4
33 changes: 9 additions & 24 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defaults:

jobs:
auto-lint:
name: Formatting
name: Formatting and Style
runs-on: ubuntu-22.04
timeout-minutes: 15
outputs:
Expand All @@ -38,6 +38,7 @@ jobs:
channel-priority: strict
environment-file: workflow/envs/lint.yml
miniforge-version: latest
use-mamba: true

- name: Run isort
run: isort .
Expand Down Expand Up @@ -65,29 +66,13 @@ jobs:
author_email: [email protected]
message: '[MISC] automatic linting'

lint:
needs: auto-lint
if: needs.auto-lint.outputs.has_changes == 'false'
name: Style Guide
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: lint
auto-activate-base: false
auto-update-conda: false
channel-priority: strict
environment-file: workflow/envs/lint.yml
miniforge-version: latest
# Wait for new commit to start new workflow run such that this run is cancelled.
# Useful for auto-merge on success of all workflows.
- name: Wait
if: needs.auto-lint.outputs.has_changes == 'true'
run: sleep 60

# Otherwise, continue.
- name: Run pylint
if: needs.auto-lint.outputs.has_changes == 'false'
run: pylint .

3 changes: 2 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ jobs:
channel-priority: strict
environment-file: workflow/envs/snakemake.yml
miniforge-version: latest
use-mamba: true

- name: Extract data
run: |
mkdir -p ${{ github.workspace }}/results
tar xf ${{ github.workspace }}/.github/data/data.tar.zst -C ${{ github.workspace }}/results
- name: Run snakemake
run: snakemake --use-conda --cores 2
run: snakemake --use-conda --conda-frontend mamba --cores 2

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ jobs:
channel-priority: strict
environment-file: workflow/envs/snakemake.yml
miniforge-version: latest
use-mamba: true

- name: Extract data
run: |
mkdir -p ${{ github.workspace }}/results
tar xf ${{ github.workspace }}/.github/data/data.tar.zst -C ${{ github.workspace }}/results
- name: Run snakemake
run: snakemake --use-conda --cores 2
run: snakemake --use-conda --conda-frontend mamba --cores 2
1 change: 0 additions & 1 deletion workflow/envs/bokeh.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: bokeh
channels:
- conda-forge
- defaults
dependencies:
- bokeh=3.4.1
1 change: 0 additions & 1 deletion workflow/envs/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: lint
channels:
- conda-forge
- defaults
dependencies:
- black=24.4.0
- isort=5.13.2
Expand Down
1 change: 0 additions & 1 deletion workflow/envs/r.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: r
channels:
- conda-forge
- defaults
dependencies:
- r-base=4.3.3
- r-here
Expand Down
1 change: 0 additions & 1 deletion workflow/envs/raptor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: raptor
channels:
- conda-forge
- defaults
dependencies:
- bioconda::raptor
1 change: 0 additions & 1 deletion workflow/envs/snakemake.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: snakemake
channels:
- conda-forge
- defaults
dependencies:
- bioconda::snakemake=8.10.7

0 comments on commit 22cedb8

Please sign in to comment.