Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci to test all plugins on PR label part1 #133

Merged
merged 2 commits into from
Mar 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/test_all_plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test all plugins

on:
pull_request:
types: [labeled]
workflow_dispatch:

jobs:
get-plugins:
if: ${{ github.event.label.name == 'test-all-plugins' && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- id: plugin_names
run: echo "::set-output name=plugins::$(curl -s https://api.napari-hub.org/plugins | jq -c 'keys')"
outputs:
plugins: ${{ steps.plugin_names.outputs.plugins }}

test_all:
needs: get-plugins
name: ${{ matrix.plugin }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plugin: ${{ fromJson(needs.get-plugins.outputs.plugins) }}
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: tlambert03/setup-qt-libs
- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
use-mamba: true

- name: Install dependencies
run: |
pip install -U pip
pip install napari PySide2 pytest

- name: Install ${{ matrix.plugin }}
- run: |
CONDA=$(curl -s -o /dev/null -w "%{http_code}" https://api.anaconda.org/package/conda-forge/${{ matrix.plugin }})
if [[ $VAR == '200' ]]
then
conda install ${{ matrix.plugin }})
echo "installed with conda"
else
pip install ${{ matrix.plugin }})
echo "installed with pip"
fi

- name: Test
run: pytest tests/test_all_plugins.py -s -v --color=yes
env:
TEST_PACKAGE_NAME: ${{ matrix.plugin }})