-
Notifications
You must be signed in to change notification settings - Fork 93
129 lines (107 loc) · 3.56 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
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 }}
env:
MSVC_TOOLSET_VERSION: "14"
strategy:
fail-fast: false
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/[email protected]
with:
arch: x64
toolset: ${{ env.MSVC_TOOLSET_VERSION }}
- name: Cache OpenCV build
if: matrix.os == 'windows-latest'
id: cache-opencv
uses: actions/cache@v3
with:
path: D:/a/graph-cut-ransac/graph-cut-ransac/opencv
key: opencv3-4-5-${{ runner.os }}-${{ env.MSVC_TOOLSET_VERSION }}-${{ hashFiles('scripts/build-opencv.ps1') }}
- name: Build OpenCV on Windows
if: matrix.os == 'windows-latest' && steps.cache-opencv.outputs.cache-hit != 'true'
run: scripts/build-opencv.ps1
shell: pwsh
- name: Cache Eigen3 build
if: matrix.os == 'windows-latest'
id: cache-eigen3
uses: actions/cache@v3
with:
path: C:/eigen3
key: eigen3-${{ runner.os }}-${{ hashFiles('scripts/build-eigen3.ps1') }}
- name: Install Eigen3 on Windows
if: matrix.os == 'windows-latest' && steps.cache-eigen3.outputs.cache-hit != 'true'
run: scripts/build-eigen3.ps1
shell: pwsh
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ENVIRONMENT_WINDOWS: 'OpenCV_DIR="D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build" Eigen3_DIR="C:/eigen3"'
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build/bin"
- uses: actions/upload-artifact@v4
with:
name: pygcransac-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:
name: Release and upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write # this permission is mandatory for trusted publishing
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Flatten directory structure
run: |
mkdir -p dist/
find . -name '*.whl' -exec mv {} dist/ \;
find . -name '*.tar.gz' -exec mv {} dist/ \;
- name: Display final structure
run: ls -R
- name: Upload to Public PyPi
uses: pypa/gh-action-pypi-publish@release/v1
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./**/*.whl