forked from ksubramz/gradunwarp
-
Notifications
You must be signed in to change notification settings - Fork 29
149 lines (136 loc) · 3.88 KB
/
test.yml
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build, test, deploy
on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -el {0}
jobs:
test:
name: Test repo install
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python:
- ["conda", "2.7"]
- ["conda", "3.6"]
- ["conda", "3.7"]
- ["native", "3.8"]
- ["native", "3.9"]
- ["native", "3.10"]
- ["native", "3.11"]
- ["native", "3.12"]
requires: ["", "requirements.txt"]
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} (native)
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python[1] }}
allow-prereleases: true
if: matrix.python[0] == 'native'
- name: Set up Python ${{ matrix.python-version }} (miniconda)
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python[1] }}
if: matrix.python[0] == 'conda'
- name: Check environment
run: |
which python
which python3
echo $CONDA_PREFIX
echo $PATH
- name: Update pip and pytest
run: python -m pip install --upgrade pip pytest pytest-cov
- name: Install requires
run: |
python -m pip install -r ${{ matrix.requires }}
if: ${{ matrix.requires }}
- name: Install gradunwarp
run: |
python -m pip install .
- name: Test
run: pytest --pyargs gradunwarp --cov gradunwarp
working-directory: /tmp
build:
name: Build packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build sdist and wheel
run: pipx run build
- name: Check packages
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*
test-dist:
name: Test package install
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python:
- ['conda', '2.7']
- ['native', '3']
package: ['sdist', 'wheel']
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Set up Python ${{ matrix.python[1] }} (native)
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python[1] }}
allow-prereleases: true
if: matrix.python[0] == 'native'
- name: Set up Python ${{ matrix.python[1] }} (miniconda)
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python[1] }}
if: matrix.python[0] == 'conda'
- name: Install sdist
run: pip install dist/*.tar.gz
if: matrix.package == 'sdist'
- name: Install wheel
run: pip install dist/*.whl
if: matrix.package == 'wheel'
- name: Check gradunwarp version
shell: bash -el -c python {0}
run: |
from gradunwarp.core.globals import VERSION
print(VERSION)
- name: Install pytest
run: pip install pytest
- name: Run tests
run: pytest -v --pyargs gradunwarp
publish:
name: Upload to PyPI
runs-on: ubuntu-latest
environment: "Package deployment"
needs: [test, test-dist]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1