-
Notifications
You must be signed in to change notification settings - Fork 20
109 lines (92 loc) · 2.8 KB
/
release.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
103
104
105
106
107
108
109
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
name: Release
on:
release:
types:
- published
branches:
- main
workflow_dispatch:
jobs:
check-main-test-status:
runs-on: ubuntu-latest
steps:
- name: OS Dependencies
run: sudo apt-get install -y curl jq
- uses: actions/checkout@v3
- name: Check main test status
run: make main-test-status
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# https://cibuildwheel.readthedocs.io/en/stable/options/#testing
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp39-* cp310-* cp311-*
CIBW_SKIP: '*-win32 *-manylinux_i686 *-musllinux*'
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_TEST_SKIP: '*-macosx_arm64'
# Completely isolate tests to prevent cibuildwheel from importing the
# source instead of the wheel. This happens when tests/__init__.py is read.
CIBW_TEST_EXTRAS: "complete,dev"
CIBW_TEST_COMMAND: >
mv {project}/pycontrails {project}/pycontrails-bak &&
python -m pytest {project}/tests &&
mv {project}/pycontrails-bak {project}/pycontrails
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi_test:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
verbose: true
verify-metadata: true
upload_pypi:
needs: [build_wheels, build_sdist, check-main-test-status]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'release' }}
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
verify-metadata: true