CI: new GHA for templating automated testing on community plugins #1
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
# # Example of workflow trigger for calling workflow (the client). | |
# name: ci-vizard | |
# on: | |
# pull_request: | |
# branches: ["dev"] | |
# push: | |
# branches: ["dev"] | |
# jobs: | |
# ci: | |
# uses: qiime2/distributions/.github/workflows/lib-community-ci.yaml@dev | |
# with: | |
# distro: amplicon | |
# release-epoch: 2024.10 | |
# additional-pkg-deps: | |
# github-org-name: qiime2 | |
# github-repo-name: q2-vizard | |
# TODO: note that default is 'main'; users can leave blank if this is their ref | |
# github-env-ref: dev | |
# env-file-name: 2024.5-vizard-environment.yml | |
on: | |
workflow_call: | |
inputs: | |
distro: | |
description: "Distro to test with" | |
type: string | |
required: true | |
release-epoch: | |
description: "Release target for distro to test with" | |
type: number | |
required: true | |
# TODO: figure out how to pass multiple external deps in correct syntax | |
additional-pkg-deps: | |
description: "Additional package dependencies" | |
type: string | |
required: false | |
default: '' | |
github-org: | |
description: "Organization or username on Github" | |
type: string | |
required: true | |
github-repo: | |
description: "Plugin repository name on Github" | |
type: string | |
required: true | |
github-env-ref: | |
description: "Target branch/ref name on Github for environment file" | |
type: string | |
required: false | |
default: 'main' | |
env-file-name: | |
description: "Name of environment file to test with" | |
type: string | |
required: true | |
jobs: | |
install-env-and-test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-12] | |
runs-on: ${{ matrix.os }} | |
env: | |
github_repo: ${{ inputs.github-repo }} | |
github_org: ${{ inputs.github-org }} | |
github_env_ref: ${{ inputs.github-env-ref }} | |
env_file_name: ${{ inputs.env-file-name }} | |
plugin_path: ./repo | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: ${{ env.plugin_path }} | |
fetch-depth: 0 | |
- name: 'Install and activate test environment' | |
run: | | |
conda env create | |
-n ${{ env.github_repo }} | |
-f https://raw.githubusercontent.com/{{ github-org }}/{{ github-repo }}/{{ github-env-ref }}/environment-files/{{ env-file-name }} | |
conda activate ${{ env.github_repo }} | |
# TODO: run tests using makefile | |
- name: 'Run tests for ${{ env.github_repo }}' | |
# USING AS A REFERENCE, DONT ERASE ME YET | |
# jobs: | |
# build-and-test: | |
# name: '${{ github.event.repository.name }} (${{ matrix.os }})' | |
# needs: setup | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: [ubuntu-latest, macos-12] | |
# runs-on: ${{ matrix.os }} | |
# env: | |
# plugin_path: ./repo | |
# built_channel_path: ./built-channel | |
# epoch: ${{ needs.setup.outputs.active-epoch }} | |
# seed_env_path: ${{ needs.setup.outputs.active-epoch }}/${{ inputs.distro }}/staged/seed-environment-conda.yml | |
# env_prefix: ./test-env | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# path: ${{ env.plugin_path }} | |
# fetch-depth: 0 | |
# - name: 'Set up test environment' | |
# run: | | |
# conda create -y -p ${{ env.env_prefix }} | |
# mkdir -p ${{ env.env_prefix }}/etc | |
# cat <<EOF > '${{ env.env_prefix }}/etc/activate.sh' | |
# . "$CONDA/etc/profile.d/conda.sh" | |
# conda activate '${{ env.env_prefix }}' | |
# EOF | |
# chmod +x '${{ env.env_prefix }}/etc/activate.sh' | |
# - name: 'set up yaml for test env' | |
# shell: bash | |
# run: | | |
# source ${{ env.env_prefix }}/etc/activate.sh | |
# conda activate '${{ env.env_prefix }}' | |
# pip install pyyaml | |
# - uses: qiime2/action-library-packaging/test-package@beta | |
# name: 'Test ${{ github.event.repository.name }}' | |
# with: | |
# conda-activate: source ${{ env.env_prefix }}/etc/activate.sh | |
# package-path: ${{ env.built_channel_path }}/${{ steps.build-package.outputs.conda-subdir }}/${{ steps.build-package.outputs.package-filename }} | |
# channels: ${{ steps.make-cbc.outputs.channels }} | |
# lint: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: checkout source | |
# uses: actions/checkout@v3 | |
# - name: set up python 3.9 | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: 3.9 | |
# - name: install dependencies | |
# run: | | |
# python -m pip install --upgrade pip | |
# pip install -q flake8 | |
# - name: run flake8 | |
# run: flake8 |