Test package and publish #35
Workflow file for this run
This file contains 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: Test package and publish | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Commit / Branch / Tag / SHA to checkout' | |
required: false | |
default: '' | |
test: | |
description: 'Run tests' | |
required: false | |
default: true | |
type: boolean | |
publish: | |
description: 'Publish' | |
required: false | |
default: 'none' | |
type: choice | |
options: | |
- 'none' | |
- 'pypi' | |
- 'test' | |
- 'conda' | |
- 'dryconda' | |
- 'test+pypi' | |
- 'pypi+conda' | |
- 'test+pypi+conda' | |
python-version: | |
description: 'Python version' | |
required: false | |
default: '3.7' | |
conda-platforms: | |
description: 'Target platforms' | |
required: false | |
default: 'noarch' | |
jobs: | |
test: | |
if: inputs.test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- python-version: "3.7" | |
pytorch-version: "1.4" | |
- python-version: "3.7" | |
pytorch-version: "1.8" | |
- python-version: "3.9" | |
pytorch-version: "1.11" | |
- python-version: "3.11" | |
pytorch-version: "2.0" | |
- python-version: "3.12" | |
pytorch-version: "2.4" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/test | |
with: | |
python-version: ${{ matrix.python-version }} | |
pytorch-version: ${{ matrix.pytorch-version }} | |
tag: ${{ inputs.tag }} | |
publish: | |
if: inputs.test && inputs.publish != 'none' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/pypi | |
if: | | |
contains(inputs.publish, 'pypi') || contains(inputs.publish, 'test') | |
with: | |
python-version: ${{ inputs.python-version }} | |
publish: ${{ inputs.publish }} | |
tag: ${{ inputs.tag }} | |
pypi-password: ${{ secrets.PYPI_TOKEN }} | |
test-password: ${{ secrets.TEST_PYPI_TOKEN }} | |
- uses: ./.github/actions/conda | |
if: contains(inputs.publish, 'conda') | |
with: | |
tag: ${{ inputs.tag }} | |
platforms: ${{ inputs.conda-platforms }} | |
dry_run: ${{ contains(inputs.publish, 'dry') }} | |
password: ${{ secrets.ANACONDA_TOKEN }} | |
publish-only: | |
if: (!inputs.test) && inputs.publish != 'none' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/pypi | |
if: | | |
contains(inputs.publish, 'pypi') || contains(inputs.publish, 'test') | |
with: | |
python-version: ${{ inputs.python-version }} | |
publish: ${{ inputs.publish }} | |
tag: ${{ inputs.tag }} | |
pypi-password: ${{ secrets.PYPI_TOKEN }} | |
test-password: ${{ secrets.TEST_PYPI_TOKEN }} | |
- uses: ./.github/actions/conda | |
if: contains(inputs.publish, 'conda') | |
with: | |
tag: ${{ inputs.tag }} | |
platforms: ${{ inputs.conda-platforms }} | |
dry-run: ${{ contains(inputs.publish, 'dry') }} | |
password: ${{ secrets.ANACONDA_TOKEN }} |