Skip to content

Commit

Permalink
CI: add new workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
misialq committed May 21, 2024
1 parent 835130b commit f23e2bc
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Test
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]

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: Install dependencies
run: python -m pip install requests

- 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
run: |
bash utilities/ci/get-dependencies.sh ${{ vars.DISTRO }} ${{ steps.fetch-tags.outputs.latest-dev-tag }}
cat environment.yml
- 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 plugin
run: pip install .

- name: Install dev dependencies
run: pip install pytest coverage

- name: Run tests
run: 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 }}
41 changes: 41 additions & 0 deletions .github/workflows/q2-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "QIIME2: build and test"
on: issue_comment

jobs:
react:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/q2ci') }}
runs-on: ubuntu-latest
steps:
- uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
body: |
<br /> **Edit:** Running QIIME 2 CI...
reactions: "+1"

ci:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/q2ci') }}
uses: qiime2/distributions/.github/workflows/lib-ci-dev.yaml@dev
with:
distro: metagenome
additional-reports-path: ./coverage.xml
additional-reports-name: coverage

coverage:
needs: [ci]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
name: 'Fetch coverage from builds'
with:
name: ${{ needs.ci.outputs.additional-reports-name }}
path: ${{ needs.ci.outputs.additional-reports-path }}

- uses: codecov/codecov-action@v4
name: 'Upload coverage'
with:
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit f23e2bc

Please sign in to comment.