CI: Add cache for Micromamba installation #154
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
pull_request: | |
paths-ignore: | |
- README.md | |
workflow_dispatch: | |
jobs: | |
generate-version: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set | |
run: | | |
echo "version=$(./devel/generate-version)" | tee -a "$GITHUB_OUTPUT" | |
echo "label=$(./devel/label-for-ref "$GITHUB_REF")" | tee -a "$GITHUB_OUTPUT" | |
outputs: | |
version: ${{ steps.set.outputs.version }} | |
label: ${{ steps.set.outputs.label }} | |
build-and-test: | |
needs: generate-version | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-12 | |
name: build and test (os=${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
# First, restore Micromamba from cache in case the installation script is not reachable. | |
- name: Restore Micromamba from cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ~/.local/bin/micromamba | |
# Cache should remain for 7 days from last usage. | |
# <https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy> | |
key: ${{ runner.os }}-micromamba | |
- name: Install Micromamba | |
run: | | |
curl -fsSL --proto 'https=' https://micro.mamba.pm/install.sh | bash | |
echo ~/.local/bin >> "$GITHUB_PATH" | |
- name: Save Micromamba to cache | |
uses: actions/cache/save@v4 | |
with: | |
path: ~/.local/bin/micromamba | |
key: ${{ runner.os }}-micromamba | |
- uses: actions/checkout@v3 | |
- run: ./devel/setup | |
- run: ./devel/build | |
env: | |
VERSION: ${{ needs.generate-version.outputs.version }} | |
- if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-outputs-${{ matrix.os }} | |
path: | | |
build/ | |
locked/ | |
- if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: build/locked/*/nextstrain-base-*.conda | |
- name: Test install of nextstrain-base | |
run: | | |
micromamba create \ | |
--yes \ | |
--prefix ./test-env \ | |
--strict-channel-priority \ | |
--override-channels \ | |
--channel ./build/locked \ | |
--channel conda-forge \ | |
--channel bioconda \ | |
nextstrain-base | |
- name: Generate summary | |
run: | | |
./devel/download-latest | |
./devel/diff-pkgs nextstrain-base-*.conda build/locked/*/nextstrain-base-*.conda \ | |
> "$GITHUB_STEP_SUMMARY" | |
release: | |
needs: | |
- generate-version | |
- build-and-test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Micromamba | |
run: | | |
curl -fsSL --proto 'https=' https://micro.mamba.pm/install.sh | bash | |
echo ~/.local/bin >> "$GITHUB_PATH" | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: packages | |
path: build/locked/ | |
- run: ./devel/setup | |
- run: ./devel/upload | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
LABEL: ${{ needs.generate-version.outputs.label }} | |
- name: Generate summary | |
run: | | |
# Replace ${x} in Markdown with value of environment variable "x". | |
perl -pe 's/\$\{(.+?)\}/$ENV{$1}/ge' \ | |
< .github/workflows/ci.release.md \ | |
> "$GITHUB_STEP_SUMMARY" | |
env: | |
VERSION: ${{ needs.generate-version.outputs.version }} | |
LABEL: ${{ needs.generate-version.outputs.label }} | |
# Run pathogen repo CI builds with the final packages | |
test-pathogen-repo-ci: | |
needs: | |
- generate-version | |
- release | |
strategy: | |
# XXX TODO: Test on multiple platforms (os, maybe arch) via the matrix too | |
matrix: | |
include: | |
- { pathogen: avian-flu, build-args: auspice/flu_avian_h5n1_ha.json } | |
- { pathogen: ebola } | |
- { pathogen: lassa } | |
# Disable mpox CI until pathogen-repo-ci supports custom build directories | |
# TODO: Re-enable once issue is resolved: https://github.com/nextstrain/.github/issues/63 | |
# - { pathogen: mpox } | |
- { pathogen: mumps } | |
- { pathogen: ncov, build-args: all_regions -j 2 --profile nextstrain_profiles/nextstrain-ci } | |
- { pathogen: rsv } | |
- { pathogen: seasonal-flu, build-args: --configfile profiles/ci/builds.yaml -p } | |
- { pathogen: zika } | |
name: test-pathogen-repo-ci (${{ matrix.pathogen }}) | |
uses: nextstrain/.github/.github/workflows/pathogen-repo-ci.yaml@master | |
with: | |
repo: nextstrain/${{ matrix.pathogen }} | |
build-args: ${{ matrix.build-args }} | |
runtimes: | | |
- conda | |
env: | | |
NEXTSTRAIN_CONDA_CHANNEL: nextstrain/label/${{ needs.generate-version.outputs.label }} | |
NEXTSTRAIN_CONDA_BASE_PACKAGE: nextstrain-base ==${{ needs.generate-version.outputs.version }} | |
artifact-name: ${{ matrix.pathogen }}-outputs | |
continue-on-error: true |