-
-
Notifications
You must be signed in to change notification settings - Fork 5
164 lines (161 loc) · 5.44 KB
/
build-test-publish.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
159
160
161
162
163
164
# Builds on all branches & PRs
# Deploys to PyPi on "release".
name: Build, test and publish
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
name: Build Wheels
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
# broken:
#- os: ubuntu-latest
# arch: aarch64
- os: macos-11
arch: x86_64
# broken:
#- os: macos-11
# arch: arm64
- os: windows-2019
arch: x86
- os: windows-2019
arch: AMD64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/')"
shell: bash
run: |
perl -i -pe "s/__version__\s*=\s*'(.*?)(\.rc.*|\.a.*|\.post.*)?'/__version__='\1.dev0+${GITHUB_SHA::8}'/" setup.py
- name: Note version
shell: bash
run: |
echo "PACKAGE_VERSION=$(python3 -- ./setup.py --version)" >> $GITHUB_ENV
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
# desmume build deps
- name: Install MacOS build deps
if: matrix.os == 'macos-11'
run: |
brew install coreutils gcc sdl2 meson glib
- name: "Windows: Set env: AMD64"
if: matrix.os == 'windows-2019' && matrix.arch == 'AMD64'
shell: bash
run: |
echo CIBW_ENVIRONMENT_WINDOWS="FASTBUILD=1" >> $GITHUB_ENV
- name: "Windows: Set env: x64"
if: matrix.os == 'windows-2019' && matrix.arch == 'x86'
shell: bash
run: |
echo CIBW_ENVIRONMENT_WINDOWS="FASTBUILD=1 BUILD_32=1" >> $GITHUB_ENV
- name: Add msbuild to PATH
if: matrix.os == 'windows-2019'
uses: microsoft/setup-msbuild@v1
# end desume build deps
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_SKIP: "*musllinux*"
CIBW_BEFORE_ALL_LINUX: "{package}/build-manylinux.sh"
CIBW_BEFORE_BUILD_WINDOWS: "rm -rf desmume_src/desmume/src/frontend/interface/windows/__bins"
CIBW_ENVIRONMENT_LINUX: 'CXXFLAGS="-DFORCE_AVX512_0=1 -D_POSIX_C_SOURCE=199309L" CFLAGS="-D_POSIX_C_SOURCE=199309L"'
CIBW_ENVIRONMENT_MACOS: "CC=gcc-10 CXX=g++-10"
CIBW_ENVIRONMENT_WINDOWS: "${{ env.CIBW_ENVIRONMENT_WINDOWS }}"
CIBW_ARCHS: ${{ matrix.arch }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.whl
build_mingw:
runs-on: windows-2019
name: Msys Wheel
strategy:
fail-fast: false
matrix:
include: [
{ msystem: MINGW64, arch: x86_64, path: mingw64 },
{ msystem: MINGW32, arch: i686, path: mingw32 }
]
steps:
- name: Install MSys2 and dependencies
uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{ matrix.msystem }}
install: >-
git
unzip
mingw-w64-${{ matrix.arch }}-curl
mingw-w64-${{ matrix.arch }}-python
mingw-w64-${{ matrix.arch }}-python-pip
mingw-w64-${{ matrix.arch }}-python-pillow
mingw-w64-${{ matrix.arch }}-openssl
mingw-w64-${{ matrix.arch }}-toolchain
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/')"
shell: msys2 {0}
run: |
perl -i -pe "s/__version__\s*=\s*'(.*?)(\.rc.*|\.a.*|\.post.*)?'/__version__='\1.dev0+${GITHUB_SHA::8}'/" setup.py
- name: Note version and add VS to path
shell: msys2 {0}
run: |
echo "PACKAGE_VERSION=$(python3 -- ./setup.py --version)" >> $GITHUB_ENV
- name: Upgrade pip
shell: msys2 {0}
run: |
python -m pip install --upgrade pip wheel
- name: Build Python wheels # microsoft/[email protected] doesn't work here
shell: msys2 {0}
run: |
PATH="$PATH:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin" python setup.py bdist_wheel
env:
BUILD_32: "${{ matrix.arch == 'x86' && '1' || '' }}"
FASTBUILD: "1"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels-msys2-py-${{ matrix.msystem }}
path: dist/*.whl
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
name: Deploy wheels to PyPI
steps:
- name: Download wheels
uses: actions/download-artifact@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload wheels/*.whl