generated from bokulich-lab/q2-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 14
115 lines (99 loc) · 4.08 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
name: Test
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
env:
DISTRO: metagenome
jobs:
test:
runs-on: ubuntu-latest
outputs:
latest-dev-tag: ${{ steps.fetch_latest_tags.outputs.latest-dev-tag }}
latest-stable-tag: ${{ steps.fetch_latest_tags.outputs.latest-stable-tag }}
steps:
- uses: actions/checkout@v4
- name: Checkout utilities
uses: actions/checkout@v4
with:
repository: bokulich-lab/utilities
path: utilities
- name: Test
run: |
echo "${{ github.event.head_commit.message }}"
echo "${{ github.event }}"
echo "${{ github.commits }}"
echo "${{ github.event.head_commit }}"
echo "event name is:" ${{ github.event_name }}
echo "event type is:" ${{ github.event.action }}
- name: Install dependencies
run: python -m pip install requests yq
- name: Fetch latest tags
id: fetch-tags
run: |
latest_tags=$(python utilities/ci/get-tags.py)
echo "$latest_tags" > tags.txt
echo "latest-dev-tag=$(grep 'latest-dev-tag' tags.txt | cut -d '=' -f 2)" >> $GITHUB_OUTPUT
echo "latest-stable-tag=$(grep 'latest-stable-tag' tags.txt | cut -d '=' -f 2)" >> $GITHUB_OUTPUT
- name: Create conda yaml
id: create-conda-yaml
run: |
bash utilities/ci/get-dependencies.sh "$DISTRO" ${{ steps.fetch-tags.outputs.latest-dev-tag }} utilities/ci/repositories.yaml
cat environment.yml >> $GITHUB_STEP_SUMMARY
echo "qiime-deps=$(tr '\n' ' ' < repo-urls.txt | xargs)" >> $GITHUB_OUTPUT
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.8
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: conda-env
condarc-file: utilities/ci/condarc
# use-only-tar-bz2: true
- name: Get date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache conda env
uses: actions/cache@v3
with:
path: /usr/share/miniconda/envs
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER
}}
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 0
id: cache
- name: Update environment
run: mamba env update -n conda-env -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install dev versions of QIIME repos
run: mamba run -n conda-env pip install ${{ steps.create-conda-yaml.outputs.qiime-deps }}
- name: Update specific dependency, if requested
if: contains(${{ github.event.head_commit.message }}, '[add:')
run: |
pkg_name=$(echo ${{ github.event.head_commit.message }} | awk -F':' '/\[add/{print $2}')
commit_hash=$(echo ${{ github.event.head_commit.message }} | awk -F':' '/\[add/{print $3}' | awk -F']' '{print $1}')
if [[ $(yq '.repositories[].name' utilities/ci/repositories.yaml | grep -c $pkg_name) -eq 1 ]]; then
pkg_url=$(yq ".repositories[] | select(.name == \"$pkg_name\") | .url" utilities/ci/repositories.yaml | tr -d '"')
mamba run -n conda-env pip install "git+$pkg_url@$commit_hash"
- name: Install plugin
run: |
mamba run -n conda-env pip install .
mamba run -n conda-env qiime dev refresh-cache
- name: Install dev dependencies
run: mamba run -n conda-env pip install pytest coverage parameterized
- name: Run tests
run: mamba run -n conda-env make test-cov
- uses: codecov/codecov-action@v4
name: Upload coverage report
with:
files: ./coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}