-
-
Notifications
You must be signed in to change notification settings - Fork 220
151 lines (134 loc) · 4.71 KB
/
build-wheel.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
name: Build wheel
on:
release:
types: [created]
workflow_call:
inputs:
branch:
default: ${{ github.ref }}
required: true
type: string
workflow_dispatch:
jobs:
build_wheel:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.7']
exclude:
- os: macos-14 # macos-14 is apple silicon
python-version: '3.7'
- os: macos-14
python-version: '3.8'
- os: macos-14
python-version: '3.9'
name: Build [${{ matrix.os }}-${{ matrix.python-version }}]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: marcelotduarte/cx_Freeze
- uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64,ppc64le
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install "`grep cibuildwheel requirements-dev.txt`"
- name: Build wheel for Python ${{ matrix.python-version }}
run: |
PY_VERSION_NODOT=$(echo ${{ matrix.python-version }}|sed 's/\.//')
if [ "${{ matrix.os }}" == "macos-13" ]; then
export CIBW_ARCHS="x86_64"
elif [ "${{ matrix.os }}" == "macos-14" ]; then
export CIBW_ARCHS="arm64"
fi
export CIBW_BUILD="cp${PY_VERSION_NODOT}-*"
python -m cibuildwheel --output-dir wheelhouse --prerelease-pythons
- name: Add sdist
if: runner.os == 'Linux' && matrix.python-version == '3.11'
run: |
python -m pip install --upgrade pip build
python -m build . --sdist -o wheelhouse
- name: Upload the artifact
uses: actions/upload-artifact@v4
with:
name: cx-freeze-pip-${{ matrix.os }}-${{ matrix.python-version }}
path: wheelhouse
publish:
name: Publish package to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
needs:
- build_wheel
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cx-Freeze
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Join files to upload
run: |
mkdir -p wheelhouse
mv artifacts/cx-freeze-pip-*/* wheelhouse/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: wheelhouse/
skip-existing: true
verbose: true
update_bases:
name: Update cx_Freeze/bases and util module
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
needs:
- build_wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
repository: marcelotduarte/cx_Freeze
token: ${{ secrets.PUSH }}
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: If changed, extract and update the base executables and util module
run: |
SHA256SUM1=$(cat source/*.c source/bases/* | sha256sum | awk '{print $1}')
SHA256SUM2=$(cat cx_Freeze/bases/__init__.py | awk '{print $2}')
if [ $SHA256SUM1 != $SHA256SUM2 ]; then
git config user.name "Marcelo Duarte"
git config user.email marcelotduarte@users.noreply.github.com
git checkout -B update_bases ${{ inputs.branch }}
# Remove any file that match - remove previous versions too
git rm --ignore-unmatch 'cx_Freeze/bases/*-win*.exe' 'cx_Freeze/util.*-win*.pyd'
# Extract base executables and util module
for file in artifacts/cx-freeze-pip-windows-*/*-win*.whl; do
unzip -o $file 'cx_Freeze/bases/*-win*.exe' 'cx_Freeze/util.*-win*.pyd'
done
git add cx_Freeze/bases/*-win*.exe cx_Freeze/util.*-win*.pyd
# Save the new SHA256SUM
echo "# $SHA256SUM1" > cx_Freeze/bases/__init__.py
git add cx_Freeze/bases/__init__.py
# Update
git commit -m "bases: update base executables and util module [ci skip]"
git push origin update_bases
fi