-
Notifications
You must be signed in to change notification settings - Fork 3
139 lines (109 loc) · 3.31 KB
/
build-package.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
name: build
on:
push:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
jobs:
build:
name: Build package
runs-on: ubuntu-latest
container:
image: ghcr.io/mrphys/tensorflow-manylinux:1.14.0
strategy:
matrix:
py_version: ["3.7", "3.8", "3.9", "3.10"]
env:
PYTHON: python${{ matrix.py_version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- name: Lint code
run: |
make lint PY_VERSION=${{ matrix.py_version }}
- name: Compile shared library
run: |
make PY_VERSION=${{ matrix.py_version }} CXX=/dt9/usr/bin/g++
- name: Install required packages
run: |
$PYTHON -m pip install -r requirements.txt
- name: Run test suite
run: |
make test PY_VERSION=${{ matrix.py_version }}
- name: Build wheel
run: |
make wheel PY_VERSION=${{ matrix.py_version }}
- name: Build docs
run: |
make docs PY_VERSION=${{ matrix.py_version }}
- name: Upload wheel
if: startsWith(github.ref, 'refs/tags')
uses: actions/upload-artifact@v2
with:
name: wheels
path: ./artifacts/*.whl
- name: Upload docs
if: startsWith(github.ref, 'refs/tags') && matrix.py_version == 3.9
uses: actions/upload-artifact@v2
with:
name: docs
path: ./tools/docs/_build/dirhtml
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
packages_dir: artifacts/
skip_existing: true
release:
name: Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout docs branch
uses: actions/checkout@v2
with:
ref: docs
- name: Clean docs branch
run: |
rm -rf ./*
- name: Download docs
uses: actions/download-artifact@v2
with:
name: docs
- name: Publish docs to GitHub Pages
run: |
git config --global user.name mrphys
git config --global user.email [email protected]
git add -A
git commit -m "Update docs [bot]" || echo "No changes to commit."
git push --force
- name: Checkout master
uses: actions/checkout@v2
- name: Get release tag
run: |
echo "release=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Create a release
uses: softprops/action-gh-release@v1
with:
name: TensorFlow MRI ${{ env.release }}
body_path: RELEASE.rst
prerelease: ${{ contains(env.release, 'a') || contains(env.release, 'b') || contains(env.release, 'rc') }}
fail_on_unmatched_files: true
- name: Download wheels
uses: actions/download-artifact@v2
with:
name: wheels
path: artifacts/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: artifacts/