-
Notifications
You must be signed in to change notification settings - Fork 4
220 lines (191 loc) · 6.34 KB
/
opengpmp.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# THIS FILE CONTAINS THE PIP PACKAGING PROCESS FOR PUBLISHING
# TO PyPI AND BUILDING FOR A PLETHORA OF PLATFORMS. THIS FILE
# SERVERS AS THE MAIN ENTRY POINT FOR THE openGPMP WORKFLOW
name: CI/CD
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
create:
types: [ tag ]
branches: [ main ]
jobs:
src_changes:
name: Check changes to src
runs-on: 'ubuntu-20.04'
# Declare outputs for next jobs
outputs:
src_changed: ${{ steps.check_file_changed.outputs.src_changed }}
steps:
- uses: actions/checkout@v2
with:
# Checkout as many commits as needed for the diff
fetch-depth: 2
- shell: pwsh # the example this is adopted from makes use of PowerShell
id: check_file_changed
run: |
# diff HEAD W/ previous commit
$diff = git diff --name-only HEAD^ HEAD
# check if specific folder with file extentions has changes
$SourceDiff = $diff | Where-Object { $_ -match '^modules/' -or $_ -match '^include/' }
$HasDiff = $SourceDiff.Length -gt 0
Write-Host "::set-output name=src_changed::$HasDiff"
test_changes:
name: Check Changes to tests
runs-on: 'ubuntu-20.04'
# Declare outputs for next jobs
outputs:
tests_changed: ${{ steps.check_file_changed.outputs.tests_changed }}
steps:
- uses: actions/checkout@v2
with:
# Checkout as many commits as needed for the diff
fetch-depth: 2
- shell: pwsh # the example this is adopted from makes use of PowerShell
id: check_file_changed
run: |
# diff HEAD W/ previous commit
$diff = git diff --name-only HEAD^ HEAD
# check if specific folder with file extentions has changes
$SourceDiff = $diff | Where-Object { $_ -match '^tests/' }
$HasDiff = $SourceDiff.Length -gt 0
Write-Host "::set-output name=tests_changed::$HasDiff"
tests_codecov:
#needs: [ test_changes ]
#if: needs.test_changes.outputs.tests_changed == 'True'
uses: ./.github/workflows/codecov.yml
documentation:
needs: [tests_codecov]
uses: ./.github/workflows/doxygen.yml
cpp:
needs: [ src_changes ]
if: needs.src_changes.outputs.src_changed == 'True'
uses: ./.github/workflows/build_nix.yml
cpp_osx:
needs: [ src_changes ]
if: needs.src_changes.outputs.src_changed == 'True'
uses: ./.github/workflows/build_osx.yml
CUDA:
needs: [ src_changes ]
if: needs.src_changes.outputs.src_changed == 'True'
uses: ./.github/workflows/CUDA.yml
python:
needs: [ cpp ]
uses: ./.github/workflows/test_wheels.yml
latest_version:
needs: [ python ]
runs-on: ubuntu-latest
steps:
- uses: oprypin/find-latest-tag@v1
with:
repository: akielaries/openGPMP
id: gpmp_version
- run: echo ${{ steps.gpmp_version.outputs.tag }}
bump_version:
needs: [ latest_version ]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Bump version and push tag
#if: github.ref == 'refs/heads/main'
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
VERBOSE: true
DEFAULT_BRANCH: main
RELEASE_BRANCHES: main
MAJOR_STRING_TOKEN: MAJOR
MINOR_STRING_TOKEN: MINOR
PATCH_STRING_TOKEN: PATCH
DEFAULT_BUMP: none
BRANCH_HISTORY: last
id: new_version
- run: echo ${{ steps.new_version.outputs.new_tag }}
build_plat:
name: Build source distribution
needs: [ bump_version , latest_version ]
if: contains(github.event.head_commit.message, '#PATCH:') || contains(github.event.head_commit.message, '#MINOR:') || contains(github.event.head_commit.message, '#MAJOR:')
#if: ${{ needs.bump_version.new_version.outputs.new_tag }} != ${{ needs.latest_version.gpmp_version.outputs.tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # required for versioneer to find tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Build sdist
run: |
pip install versioneer
#pip install autopep8
#python setup.py build_ext --inplace
pipx run build --sdist
#autopep8 --recursive --in-place --aggressive --aggressive .
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
compile_wheels:
name: Build Wheels on ${{ matrix.os }}
needs: [ build_plat ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # required for versioneer to find tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Install Versioneer
run: |
pip install versioneer
git status
#git clean -xdfq
#git status
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ENVIRONMENT: "CC='g++' CXX='g++' CFLAGS='-std=c++2a' CXXFLAGS='-std=c++2a'"
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
CIBW_BEFORE_BUILD: "git status"
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
publish:
name: Publish to PYPI
needs: [ compile_wheels, build_plat ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# the build installation is supported by x86 based OSX
# versions and LINUX distros by the CIBUILDWHEEL utilities.
# test pip install pygpmp on the following platforms
pip_test:
needs: publish
uses: ./.github/workflows/test_pip.yml