Add fake env file #4
This file contains hidden or 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
name: lint-pr | |
# Run on PR changing files in plugins dir against main | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
paths: | |
- '/plugins/**' | |
jobs: | |
lint-yml: | |
runs-on: ubuntu-latest | |
outputs: | |
ENV_FILES: ${{ steps.lint.outputs.ENV_FILES }} | |
steps: | |
# Checkout new commit and prior HEAD | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
# Get diff | |
# This feels odd to me got it from | |
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#multiline-strings | |
- name: Get Diff | |
run: | | |
{ | |
echo 'DIFF<<EOF' | |
git diff --name-only HEAD~ HEAD | |
echo EOF | |
} >> "$GITHUB_ENV" | |
# Lint all plugins/** files in diff (filtering of diff occurs in Python) | |
# Also gets all env files in added plugins for env testing | |
- name: Lint Yml and Get Env Files | |
id: lint | |
run: python .github/scripts/lint.py ${{ secrets.GITHUB_TOKEN }} $DIFF | |
# Install all envs found and at least make sure `qiime info` runs | |
# TODO: Make this attempt to run pytest? | |
test-envs: | |
needs: lint-yml | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-13] | |
url: ${{ fromJSON(needs.lint-yml.outputs.ENV_FILES) }} | |
runs-on: ${{ matrix.os }} | |
env: | |
prefix: ./test | |
steps: | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: '' | |
architecture: 'x64' | |
auto-activate-base: true | |
miniconda-version: 'latest' | |
# Hacky stff to make it so I can activate the conda env for testing | |
- name: Set up Test Environment | |
env: | |
url: ${{ matrix.url }} | |
run: | | |
conda env create -y -p ${{ env.prefix }} -f $url | |
mkdir -p ${{ env.prefix }}/etc | |
cat <<EOF > '${{ env.prefix }}/etc/activate.sh' | |
. "$CONDA/etc/profile.d/conda.sh" | |
conda activate '${{ env.prefix }}' | |
EOF | |
chmod +x 'test/etc/activate.sh' | |
- name: Test | |
run: | | |
source ${{ env.prefix }}/etc/activate.sh | |
conda activate ${{ env.prefix }} | |
qiime info | |
# Grab the target repo and validate it? | |
# Description? | |
# README? | |
# Env files? |