|
| 1 | +name: Test and Deploy bioimageio.core |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ "**" ] |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: micromamba-shell {0} |
| 12 | + |
| 13 | +jobs: |
| 14 | + black: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - uses: psf/black@stable |
| 19 | + with: |
| 20 | + options: "--check --verbose" |
| 21 | + src: "." |
| 22 | + jupyter: true |
| 23 | + version: "24.3" |
| 24 | + |
| 25 | + test-spec-conda: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - name: Install Conda environment with Micromamba |
| 33 | + if: matrix.python-version != '3.8' |
| 34 | + uses: mamba-org/setup-micromamba@v1 |
| 35 | + with: |
| 36 | + cache-downloads: true |
| 37 | + cache-environment: true |
| 38 | + environment-file: dev/env-wo-python.yaml |
| 39 | + create-args: >- |
| 40 | + python=${{ matrix.python-version }} |
| 41 | + post-cleanup: 'all' |
| 42 | + - name: Install py3.8 environment |
| 43 | + if: matrix.python-version == '3.8' |
| 44 | + uses: mamba-org/setup-micromamba@v1 |
| 45 | + with: |
| 46 | + cache-downloads: true |
| 47 | + cache-environment: true |
| 48 | + environment-file: dev/env-py38.yaml |
| 49 | + post-cleanup: 'all' |
| 50 | + - name: additional setup |
| 51 | + run: pip install --no-deps -e . |
| 52 | + - name: pytest-spec-conda |
| 53 | + run: pytest --disable-pytest-warnings |
| 54 | + |
| 55 | + test-spec-main: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + strategy: |
| 58 | + matrix: |
| 59 | + python-version: ['3.8', '3.12'] |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - name: Install Conda environment with Micromamba |
| 63 | + if: matrix.python-version != '3.8' |
| 64 | + uses: mamba-org/setup-micromamba@v1 |
| 65 | + with: |
| 66 | + cache-downloads: true |
| 67 | + cache-environment: true |
| 68 | + environment-file: dev/env-wo-python.yaml |
| 69 | + create-args: >- |
| 70 | + python=${{ matrix.python-version }} |
| 71 | + post-cleanup: 'all' |
| 72 | + - name: Install py3.8 environment |
| 73 | + if: matrix.python-version == '3.8' |
| 74 | + uses: mamba-org/setup-micromamba@v1 |
| 75 | + with: |
| 76 | + cache-downloads: true |
| 77 | + cache-environment: true |
| 78 | + environment-file: dev/env-py38.yaml |
| 79 | + post-cleanup: 'all' |
| 80 | + - name: additional setup |
| 81 | + run: | |
| 82 | + conda remove --yes --force bioimageio.spec || true # allow failure for cached env |
| 83 | + pip install --no-deps git+https://github.com/bioimage-io/spec-bioimage-io |
| 84 | + pip install --no-deps -e . |
| 85 | + - name: pytest-spec-main |
| 86 | + run: pytest --disable-pytest-warnings |
| 87 | + |
| 88 | + test-tf: |
| 89 | + runs-on: ubuntu-latest |
| 90 | + strategy: |
| 91 | + matrix: |
| 92 | + python-version: ['3.9', '3.11'] |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + - name: Install Conda environment with Micromamba |
| 96 | + uses: mamba-org/setup-micromamba@v1 |
| 97 | + with: |
| 98 | + cache-downloads: true |
| 99 | + cache-environment: true |
| 100 | + environment-file: dev/env-tf.yaml |
| 101 | + condarc: | |
| 102 | + channel-priority: flexible |
| 103 | + create-args: >- |
| 104 | + python=${{ matrix.python-version }} |
| 105 | + post-cleanup: 'all' |
| 106 | + - name: additional setup |
| 107 | + run: pip install --no-deps -e . |
| 108 | + - name: pytest-spec-tf |
| 109 | + run: pytest --disable-pytest-warnings |
| 110 | + |
| 111 | + conda-build: |
| 112 | + runs-on: ubuntu-latest |
| 113 | + needs: test-spec-conda |
| 114 | + steps: |
| 115 | + - name: checkout |
| 116 | + uses: actions/checkout@v4 |
| 117 | + with: |
| 118 | + fetch-depth: 0 |
| 119 | + - name: Install Conda environment with Micromamba |
| 120 | + uses: mamba-org/setup-micromamba@v1 |
| 121 | + with: |
| 122 | + cache-downloads: true |
| 123 | + cache-environment: true |
| 124 | + environment-name: build-env |
| 125 | + condarc: | |
| 126 | + channels: |
| 127 | + - conda-forge |
| 128 | + create-args: | |
| 129 | + boa |
| 130 | + - name: linux conda build |
| 131 | + run: | |
| 132 | + conda mambabuild -c conda-forge conda-recipe |
| 133 | +
|
| 134 | + docs: |
| 135 | + if: github.ref == 'refs/heads/main' |
| 136 | + runs-on: ubuntu-latest |
| 137 | + steps: |
| 138 | + - uses: actions/checkout@v4 |
| 139 | + - uses: actions/setup-python@v5 |
| 140 | + with: |
| 141 | + python-version: '3.12' |
| 142 | + cache: 'pip' |
| 143 | + - run: pip install -e .[dev] |
| 144 | + - id: get_version |
| 145 | + run: python -c 'import bioimageio.core;print(f"version={bioimageio.core.__version__}")' >> $GITHUB_OUTPUT |
| 146 | + - name: Generate developer docs |
| 147 | + run: | |
| 148 | + pdoc \ |
| 149 | + --logo https://bioimage.io/static/img/bioimage-io-logo.svg \ |
| 150 | + --logo-link https://bioimage.io/ \ |
| 151 | + --favicon https://bioimage.io/static/img/bioimage-io-icon-small.svg \ |
| 152 | + --footer-text 'bioimageio.core ${{steps.get_version.outputs.version}}' \ |
| 153 | + -o ./dist bioimageio.core |
| 154 | + - run: cp README.md ./dist/README.md |
| 155 | + - name: Deploy to gh-pages 🚀 |
| 156 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 157 | + with: |
| 158 | + branch: gh-pages |
| 159 | + folder: dist |
0 commit comments