-
Notifications
You must be signed in to change notification settings - Fork 46
142 lines (118 loc) · 4.04 KB
/
release.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
name: Build release binaries
on:
release:
types: [published]
env:
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
archs: "x86_64"
platform: "Linux"
- os: windows-2019
archs: "AMD64"
platform: "Windows"
steps:
- name: Setup Python
uses: actions/setup-python@v5
- name: Install Python dependencies
run: python -m pip install numpy>=1.16 six setuptools
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.22.x'
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON -DBUILD_CLIENT=ON -DBUILD_PYTHON=ON -DBUILD_PLATFORM="${{ matrix.platform }}"
- name: Compile
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Build ZIP package
working-directory: ${{github.workspace}}/build
run: cpack -C ${{env.BUILD_TYPE}} --config CPackConfig.cmake
- name: Build Python source package
working-directory: ${{github.workspace}}/build/python
run: python setup.py sdist
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_BUILD: "cp311-* pp310-*"
with:
package-dir: ${{github.workspace}}/build/python
output-dir: ${{github.workspace}}/build/python/dist
#- name: Build Python wheels
# working-directory: ${{github.workspace}}/build/python
# run: python -m cibuildwheel --output-dir dist
- name: Upload ZIP artifacts
uses: actions/upload-artifact@v4
if: ${{ !env.ACT }}
with:
name: zip-${{ matrix.os }}-${{ strategy.job-index }}
path: ${{github.workspace}}/build/trax*.zip
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
if: ${{ !env.ACT }}
with:
name: wheel-${{ matrix.os }}-${{ strategy.job-index }}
path: ${{github.workspace}}/build/python/dist/*.*
- name: Copy artifacts to output directory
if: ${{ env.ACT }}
run: |
mkdir -p /output
cp ${{github.workspace}}/build/python/dist/*.* /output/
cp ${{github.workspace}}/build/*.zip /output/
publish-pypi:
runs-on: ubuntu-20.04
needs: build
environment:
name: pypi
url: https://pypi.org/p/vot-trax
permissions:
id-token: write
steps:
- name: Get artifacts from build job
uses: actions/download-artifact@v4
if: ${{ !env.ACT }}
with:
pattern: wheel-*
merge-multiple: true
path: ${{github.workspace}}/pypi/
- name: Publish package to PyPI using OCID
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ !env.ACT }}
with:
packages-dir: ${{github.workspace}}/pypi/
publish-github:
runs-on: ubuntu-20.04
needs: build
environment:
name: github
url:
permissions:
id-token: write
contents: write
steps:
- name: Get artifacts from build job
uses: actions/download-artifact@v4
if: ${{ !env.ACT }}
with:
pattern: zip-*
merge-multiple: true
path: ${{github.workspace}}/zip
- name: Upload binaries to release using OCID
uses: softprops/action-gh-release@v1
if: ${{ !env.ACT }}
with:
files: ${{github.workspace}}/zip/*.zip
token: ${{ secrets.GITHUB_TOKEN }}