From 36b76e242841d153e41a85197b2813a4befcfae0 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Wed, 16 Mar 2022 15:08:05 -0400 Subject: [PATCH 1/2] just add ci --- .github/workflows/ci.yml | 2 + .github/workflows/test_all_plugins.yml | 61 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/test_all_plugins.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1db77e42..05406eea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ on: jobs: test: + if: ${{ github.event.label.name != 'test-all-plugins' }} name: ${{ matrix.platform }} (${{ matrix.python-version }}) runs-on: ${{ matrix.platform }} strategy: @@ -43,6 +44,7 @@ jobs: fail_ci_if_error: true test_napari: + if: ${{ github.event.label.name != 'test-all-plugins' }} name: napari tests runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test_all_plugins.yml b/.github/workflows/test_all_plugins.yml new file mode 100644 index 00000000..d0f9da63 --- /dev/null +++ b/.github/workflows/test_all_plugins.yml @@ -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 }}) From 2aad05271a701dcfcd352617c3eebc4fc838d922 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Wed, 16 Mar 2022 15:12:11 -0400 Subject: [PATCH 2/2] revert changes to main test --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05406eea..1db77e42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ on: jobs: test: - if: ${{ github.event.label.name != 'test-all-plugins' }} name: ${{ matrix.platform }} (${{ matrix.python-version }}) runs-on: ${{ matrix.platform }} strategy: @@ -44,7 +43,6 @@ jobs: fail_ci_if_error: true test_napari: - if: ${{ github.event.label.name != 'test-all-plugins' }} name: napari tests runs-on: ubuntu-latest steps: