forked from Tulip-Dev/tulip
-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (130 loc) · 5.24 KB
/
windows-wheels-build.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
name: windows-wheels-build
on: [push, pull_request]
jobs:
windows:
name: Talipot Python ${{ matrix.python-version }} wheel build on windows
runs-on: windows-latest
env:
TWINE_REPOSITORY: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
defaults:
run:
shell: msys2 {0}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Talipot code
uses: actions/checkout@v3
- name: Install mingw64 and Talipot build dependencies
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ccache
mingw-w64-x86_64-yajl
mingw-w64-x86_64-zstd
mingw-w64-x86_64-qhull
mingw-w64-x86_64-graphviz
mingw-w64-x86_64-libgit2
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
id: python-install
with:
python-version: ${{ matrix.python-version }}
- name: Install sip, twine and wheel Python packages
run: |
PYTHON_PATH=$(echo '${{ steps.python-install.outputs.python-path }}')
export PATH=$(cygpath -u "$(dirname $PYTHON_PATH)\Scripts"):$PATH
pip install sip twine wheel
- name: Get wheel next dev version
run: |
PYTHON_PATH=$(echo '${{ steps.python-install.outputs.python-path }}')
export PATH=$(cygpath -u "$(dirname $PYTHON_PATH)"):$PATH
JSON=$(curl -s 'https://test.pypi.org/pypi/talipot/json')
LAST_VERSION=$(echo $JSON | python -c "
import sys, json
print(json.load(sys.stdin)['info']['version'])" 2>/dev/null)
if [ $? -ne 0 ]
then
DEV_VERSION=1
else
echo last wheel dev version = $LAST_VERSION
# check if dev wheel version needs to be incremented
VERSION_INCREMENT=$(echo $JSON | python -c "
import sys, json
releases = json.load(sys.stdin)['releases']['$LAST_VERSION']
print(any(['win_amd64' in r['filename'] for r in releases]))")
DEV_VERSION=$(echo $LAST_VERSION | cut -f4 -d '.' | sed 's/dev//')
if [ "$VERSION_INCREMENT" == "True" ]
then
let DEV_VERSION+=1
fi
fi
echo current wheel dev version = $DEV_VERSION
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_ENV
- name: Prepare ccache timestamp
id: get-current-date
run: |
echo "date=$(date -u "+%Y-%m-%d-%H-%m-%S")" >> $GITHUB_OUTPUT
- name: Get ccache directory
id: get-cccache-dir
run: |
ccache_dir=$(ccache -sv | grep "Cache directory" | awk '{print $3}')
echo "ccache-dir=$ccache_dir" >> $GITHUB_OUTPUT
- name: Cache files
uses: actions/cache@v3
with:
path: ${{ steps.get-cccache-dir.outputs.ccache-dir }}
key:
windows-wheel-${{ steps.python-install.outputs.python-version }}-build-ccache
-${{ steps.get-current-date.outputs.date }}
restore-keys: |
windows-wheel-${{ steps.python-install.outputs.python-version }}-build-ccache
- name: Create build directory
run: mkdir build
- name: Configure Talipot Python wheel build with CMake
working-directory: ./build
run: cmake .. -G "MSYS Makefiles"
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_NEED_RESPONSE=ON
-DCMAKE_INSTALL_PREFIX=$PWD/install
-DTALIPOT_ACTIVATE_PYTHON_WHEEL_TARGET=ON
-DTALIPOT_PYTHON_TEST_WHEEL_SUFFIX=a2.dev${{ env.DEV_VERSION }}
-DPython3_EXECUTABLE=$(cygpath -u "${{ steps.python-install.outputs.python-path }}")
-DTALIPOT_USE_CCACHE=ON
-DTALIPOT_BUILD_CORE_ONLY=ON
-DTALIPOT_BUILD_DOC=OFF
- name: Talipot Python wheel build
working-directory: ./build
run: make -j4 test-wheel
- name: Upload Talipot Python wheel on test PyPI
if: github.ref == 'refs/tags/dev-latest'
working-directory: ./build
run: make test-wheel-upload
- name: Test uploaded wheel in clean environment
if: github.ref == 'refs/tags/dev-latest'
run: |
PYTHON_PATH=$(echo '${{ steps.python-install.outputs.python-path }}')
export PATH=$(cygpath -u "$(dirname $PYTHON_PATH)"):$PATH
export PATH=$(cygpath -u "$(dirname $PYTHON_PATH)\Scripts"):$PATH
pacman --noconfirm -Rc \
mingw-w64-x86_64-toolchain \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-ccache \
mingw-w64-x86_64-zlib \
mingw-w64-x86_64-yajl \
mingw-w64-x86_64-zstd \
mingw-w64-x86_64-qhull \
mingw-w64-x86_64-graphviz
pip install --index-url https://test.pypi.org/simple/ talipot
python -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"