Skip to content

CI

CI #273

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths-ignore:
- README.md
pull_request:
paths-ignore:
- README.md
workflow_dispatch:
defaults:
run:
# This is the same as GitHub Action's `bash` keyword as of 14 May 2024:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
#
# Completely spelling it out here so that GitHub can't change it out from under us
# and we don't have to refer to the docs to know the expected behavior.
shell: bash --noprofile --norc -eo pipefail {0}
jobs:
generate-version:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- 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:
- name: Install Micromamba
run: |
curl -fsSL --proto 'https=' https://micro.mamba.pm/install.sh | bash
echo ~/.local/bin >> "$GITHUB_PATH"
- uses: actions/checkout@v4
- run: ./devel/setup
- run: ./devel/build
env:
VERSION: ${{ needs.generate-version.outputs.version }}
- if: always()
uses: actions/upload-artifact@v4
with:
name: build-outputs-${{ matrix.os }}
path: |
build/
locked/
- if: always()
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.os }}
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@v4
- uses: actions/upload-artifact/merge@v4
with:
name: packages
pattern: packages-*
- uses: actions/download-artifact@v4
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
# This is running pathogen-repo-ci@v0 for pathogen repos that do not conform
# to the standard pathogen repo structure and is not expected to be updated.
# Any new pathogen repos should be added to the job using the latest version
# of the pathogen-repo-ci below.
test-pathogen-repo-ci-v0:
needs:
- generate-version
- release
strategy:
matrix:
include:
- { pathogen: avian-flu, build-args: --configfile config/gisaid.yaml -pf test_target }
- { pathogen: ebola }
- { 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 }
name: test-pathogen-repo-ci@v0 (${{ matrix.pathogen }})
uses: nextstrain/.github/.github/workflows/pathogen-repo-ci.yaml@v0
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
# Run pathogen repo CI builds with the final packages
# This is running pathogen-repo-ci@master for pathogen repos that _do_ follow
# standard pathogen repo structure and new pathogens should be added here
# to be supported for future updates such as testing on multiple platforms.
test-pathogen-repo-ci:
needs:
- generate-version
- release
strategy:
# XXX TODO: Test on multiple platforms (os, maybe arch) via the matrix too
matrix:
pathogen:
- dengue
- lassa
- measles
- mpox
- seasonal-cov
- zika
name: test-pathogen-repo-ci (${{ matrix.pathogen }})
uses: nextstrain/.github/.github/workflows/pathogen-repo-ci.yaml@master
with:
repo: nextstrain/${{ matrix.pathogen }}
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