-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (98 loc) · 2.95 KB
/
test-and-publish.yaml
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
99
100
101
102
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.8"
- python-version: "3.9"
pytorch-version: "1.11"
- python-version: "3.11"
pytorch-version: "2.0"
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 }}