-
Notifications
You must be signed in to change notification settings - Fork 16
113 lines (92 loc) · 3.13 KB
/
Copy pathpython-package.yml
File metadata and controls
113 lines (92 loc) · 3.13 KB
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
name: 'Build Python packages'
on:
push:
branches: [ master, release ]
pull_request:
branches: master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, windows-2019 ]
python-version: ["3.6.8", "3.7.1", "3.8.0", "3.9.0", "3.10.0", "3.11.0", "3.12.0"]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Make build folder
shell: bash
run: mkdir -p build
- name: Install software (linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt update
sudo apt -y install freeglut3-dev
- name: Install Python packages
shell: bash
run: |
python -m pip install -U wheel setuptools twine
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
# Configure
- name: Configure CMake project (linux)
if: runner.os == 'Linux'
working-directory: 'build'
shell: bash
run: |
cmake -DUSE_GLX=ON -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") ..
- name: Configure CMake project (windows)
if: runner.os == 'Windows'
working-directory: 'build'
shell: bash
run: |
cmake -DUSE_OPENGL=ON ..
# Build
- name: Build library (linux)
if: runner.os == 'Linux'
working-directory: 'build'
shell: bash
run: |
make -j`nproc` beatmup
- name: Build library (windows)
if: runner.os == 'Windows'
working-directory: 'build'
shell: cmd
run: |
msbuild glew-build/glew.sln -m:2 /property:Configuration=Release /property:Platform=x64
msbuild Apps.sln -m:2 /property:Configuration=Release /property:Platform=x64
# Build wheel
- name: Build wheel
working-directory: 'python'
shell: bash
run: |
python setup.py bdist_wheel clean
# Run Python
- name: Run Python
working-directory: 'python/dist'
shell: bash
run: |
python -m pip install --no-index --find-links=. beatmup
python -c "import beatmup; beatmup.say_hi()"
# Upload artifacts (release only)
- name: Upload artifacts (release only)
if: github.ref == 'refs/heads/release'
uses: actions/upload-artifact@v2
with:
name: python${{ matrix.python-version }}-${{ matrix.os }}
path: python/dist/*.whl
# Upload to PyPi (release only)
- name: Upload to PyPi (release only)
if: github.ref == 'refs/heads/release' && runner.os == 'Windows' # because pypi does not accept non-manylinux packages
working-directory: 'python'
shell: bash
run: python -m twine upload --repository pypi -u __token__ -p ${{ secrets.pypi_password }} dist/*