-
Notifications
You must be signed in to change notification settings - Fork 65
135 lines (114 loc) · 3.92 KB
/
build-and-deploy.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
name: Build and upload
on:
pull_request:
push:
tags:
- "*"
branches:
- "master"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup MSVC Developer Command Prompt
if: matrix.os == 'windows-latest'
uses: TheMrMilchmann/setup-msvc-dev@v3.0.1
with:
arch: x64
toolset: "14"
- name: Cache OpenCV build
if: matrix.os == 'windows-latest'
id: cache-opencv
uses: actions/cache@v4
with:
path: D:/a/magsac/magsac/opencv
key: opencv3-4-5-${{ runner.os }}-${{ hashFiles('graph-cut-ransac/scripts/build-opencv.ps1') }}
- name: Build OpenCV on Windows
if: matrix.os == 'windows-latest' && steps.cache-opencv.outputs.cache-hit != 'true'
run: graph-cut-ransac/scripts/build-opencv.ps1
shell: pwsh
- name: Cache Eigen3 build
if: matrix.os == 'windows-latest'
id: cache-eigen3
uses: actions/cache@v4
with:
path: C:/eigen3
key: eigen3-${{ runner.os }}-${{ hashFiles('graph-cut-ransac/scripts/build-eigen3.ps1') }}
- name: Install Eigen3 on Windows
if: matrix.os == 'windows-latest' && steps.cache-eigen3.outputs.cache-hit != 'true'
run: graph-cut-ransac/scripts/build-eigen3.ps1
shell: pwsh
- name: Cache gflags build
if: matrix.os == 'windows-latest'
id: cache-gflags
uses: actions/cache@v4
with:
path: D:/a/magsac/magsac/gflags/build_
key: opencv-${{ runner.os }}-${{ hashFiles('scripts/build-gflags.ps1') }}
- name: Build gflags on Windows
if: matrix.os == 'windows-latest' && steps.cache-gflags.outputs.cache-hit != 'true'
run: |
choco install ninja
scripts/build-gflags.ps1
shell: pwsh
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ENVIRONMENT_WINDOWS: 'OpenCV_DIR="D:/a/magsac/magsac/opencv/build" Eigen3_DIR="C:/eigen3" gflags_DIR=D:/a/magsac/magsac/gflags/build_'
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path D:/a/magsac/magsac/opencv/build/bin"
- uses: actions/upload-artifact@v4
with:
name: pymagsac-wheels-${{ runner.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build
run: |
rm -rf build # remove conflicting directory
pipx run build --sdist
- name: Validate
run: |
pip install twine
twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: pygcransac-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
permissions:
id-token: write # this permission is mandatory for trusted publishing
contents: write # required for creating releases
steps:
- uses: actions/download-artifact@v4
- name: Flatten directory structure
run: |
mkdir -p dist/
find . -name '*.whl' -exec mv {} dist/ \;
find . -name '*.tar.gz' -exec mv {} dist/ \;
- name: Upload to Public PyPi
uses: pypa/gh-action-pypi-publish@release/v1
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
./**/*.whl