File: test_conversion.yml

package info (click to toggle)
python-npe2 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 780 kB
  • sloc: python: 7,236; makefile: 19
file content (98 lines) | stat: -rw-r--r-- 3,539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Test Plugin Conversion

on:
  # push:
  # pull_request:
  workflow_dispatch:

concurrency:
  group: convert-${{ github.ref }}
  cancel-in-progress: true

jobs:
  get-plugins:
    runs-on: ubuntu-latest
    steps:
      - 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 }}

  convert:
    needs: get-plugins
    name: convert ${{ matrix.plugin }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        # plugin: ["napari-dv"]
        plugin: ${{ fromJson(needs.get-plugins.outputs.plugins) }}

    steps:
      - uses: tlambert03/setup-qt-libs@19e4ef2d781d81f5f067182e228b54ec90d23b76 # v1.8
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          python-version: 3.9

      - name: Install dependencies
        run: |
          pip install -U pip
          # just in case... we ask them not to depend on this or Pyside
          # since it's up to the enduser to have with napari
          pip install PyQt5
          pip install git+https://github.com/napari/npe2.git@refs/pull/60/head#egg=npe2

      - name: Fetch repo URL
        run: |
          URL=$(curl -s https://api.napari-hub.org/plugins/${{ matrix.plugin }} | jq '.code_repository')
          URL=${URL#'"https://github.com/'}
          URL=${URL%'"'}
          echo "plugin_repo=$URL" >> $GITHUB_ENV

      - name: Checkout plugin repo
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          repository: ${{ env.plugin_repo }}
          path: 'plugin_repo'
          fetch-depth: 0

      - name: Install ${{ matrix.plugin }}
        run: pip install -e ./plugin_repo

      - name: Test Conversion
        id: test-without-napari
        uses: aganders3/headless-gui@f85dd6316993505dfc5f21839d520ae440c84816 # v2.2
        continue-on-error: true
        with:
          run: npe2 convert ./plugin_repo

      - name: Install napari
        if: ${{ steps.test-without-napari.outcome == 'failure' }}
        run: pip install napari

      - name: Test Conversion again with napari
        id: test-with-napari
        if: ${{ steps.test-without-napari.outcome == 'failure' }}
        uses: aganders3/headless-gui@f85dd6316993505dfc5f21839d520ae440c84816 # v2.2
        with:
          run: npe2 convert ./plugin_repo

      - name: Test Conversion again with napari
        if: ${{ steps.test-without-napari.outcome == 'failure' && steps.test-with-napari.outcome == 'failure' }}
        uses: aganders3/headless-gui@f85dd6316993505dfc5f21839d520ae440c84816 # v2.2
        with:
          # try without modifying directory
          run: npe2 convert -n ${{ matrix.plugin }}

      # this won't work, we'd need to first fork the repo somewhere we have write permissions
      # then push changes that that repository, and then create a PR to the original repo
      # - name: Create Pull Request
      #   if: success()
      #   uses: peter-evans/create-pull-request@v3
      #   with:
      #     commit-message: convert plugin to npe2 format
      #     title: 'Convert to npe2 plugin'
      #     body: |
      #       This PR adds an (autogenerated) npe2 manifest, and updates setup.cfg (if setup.cfg is used).
      #       If you use setup.py instead, please update the entry_point manually:
      #         entry_points = {'napari.manifest': "your-package = your_package:napari.yaml"}