-
Notifications
You must be signed in to change notification settings - Fork 8
158 lines (153 loc) · 5.1 KB
/
python-package.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
name: Python package
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
build-sdist:
runs-on: 'ubuntu-latest'
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Create sdist
run: |
./cddlib-makefile-gmp.sh
python setup.py sdist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*
if-no-files-found: error
test-ubuntu-macos:
runs-on: ${{ matrix.os }}
needs: build-sdist
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
cython-version: ['']
include:
# test oldest supported Cython version on most recent Python
- os: 'ubuntu-latest'
python-version: '3.11'
cython-version: '==3.0.0'
steps:
- uses: actions/checkout@v3 # no submodules needed here, just checking out for the test suite
- name: Download sdist
uses: actions/download-artifact@v3
with:
name: sdist
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install libgmp (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y libgmp-dev
- name: Install libgmp (MacOS)
if: matrix.os == 'macos-latest'
run: brew install gmp
- name: Install Python dependencies
run: |
python -m pip install Cython${{ matrix.cython-version }} Sphinx pytest wheel numpy
- name: Install tarball
run: |
ls
python -m pip install --pre --no-index --find-links=. pycddlib
- name: Run test suite
run: |
pytest
cd docs
make doctest
build-mpir:
runs-on: 'windows-latest'
strategy:
fail-fast: false
matrix:
architecture: ['x86', 'x64']
platformtoolset: ['v143'] # all supported python versions can use this one
steps:
- name: Setup msbuild (Windows)
uses: microsoft/setup-msbuild@v1.1
- uses: actions/cache@v2
id: mpir-installed-cache
with:
path: mpir-mpir-3.0.0/lib/*/Release/
key: mpir-0-${{ matrix.platformtoolset }}-${{ matrix.architecture }}
- name: Install mpir
if: steps.mpir-installed-cache.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri "https://github.com/wbhart/mpir/archive/refs/heads/mpir-3.0.0.zip" -OutFile "mpir-3.0.0.zip"
7z x mpir-3.0.0.zip > NUL
if ("${{ matrix.architecture }}" -eq "x86") { $platform = "Win32" } else { $platform = "x64" }
msbuild mpir-mpir-3.0.0\build.vc14\lib_mpir_gc\lib_mpir_gc.vcxproj /p:Configuration=Release /p:Platform=$platform /p:PlatformToolset=${{ matrix.platformtoolset }} /verbosity:normal
dir mpir-mpir-3.0.0/lib/$platform/Release/
- name: Upload mpir
uses: actions/upload-artifact@v3
with:
name: mpir-${{ matrix.platformtoolset }}-${{ matrix.architecture }}
path: mpir-mpir-3.0.0/lib/*/Release/
if-no-files-found: error
build-test-windows:
runs-on: 'windows-latest'
needs: build-mpir
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
architecture: ['x86', 'x64']
platformtoolset: ['v143'] # all supported python versions can use this one
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download mpir
uses: actions/download-artifact@v3
with:
name: mpir-${{ matrix.platformtoolset }}-${{ matrix.architecture }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Check Python
run: |
if ("${{ matrix.architecture }}" -eq "x86") { $platform = "Win32" } else { $platform = "x64" }
ls $platform/Release/
python --version
python -c "import struct; print(struct.calcsize('P') * 8)"
- name: Install Python dependencies
run: |
python -m pip install Cython Sphinx pytest wheel numpy
- name: Create bdist_wheel
run: |
./cddlib-makefile-gmp.ps1
dir cddlib/lib-src/
if ("${{ matrix.architecture }}" -eq "x86") { $platform = "Win32" } else { $platform = "x64" }
mkdir dist -Force
pip wheel -w dist --global-option="build_ext" --global-option="-I$platform/Release/" --global-option="-L$platform/Release/" .
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: windows-wheels
path: dist/*
if-no-files-found: error
- name: Install wheel
run: |
cd dist
ls
pip install --pre --no-index --find-links=. pycddlib
cd ..
- name: Run test suite
run: |
pytest
cd docs
make doctest