-
Notifications
You must be signed in to change notification settings - Fork 1
193 lines (171 loc) · 6.13 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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