-
Notifications
You must be signed in to change notification settings - Fork 10
112 lines (106 loc) · 3.89 KB
/
whole-mapel-pub.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: whole-mapel-pub
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]*'
env:
WHL_HOUSE: wheelhouse
MAPEL_EL_ARTS: mapel-election-artifacts
MAPEL_REST_ARTS: mapel-rest-artifacts
permissions:
contents: read
jobs:
build-python-wheels-and-sdists:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: make sdists
run: |
mkdir -p $WHL_HOUSE
python -m pip install build
python -m build --sdist --outdir $WHL_HOUSE ./mapel-all/
python -m build --sdist --outdir $WHL_HOUSE ./mapel-core/
python -m build --sdist --outdir $WHL_HOUSE ./mapel-elections/
python -m build --sdist --outdir $WHL_HOUSE ./mapel-roommates/
python -m build --sdist --outdir $WHL_HOUSE ./mapel-marriages/
ls ./$WHL_HOUSE # Listing the contents of ./$WHL_HOUSE for a sanity check
- name: Build pure-Python wheels
run: |
pip wheel ./mapel-all --no-deps -w $WHL_HOUSE
pip wheel ./mapel-core --no-deps -w $WHL_HOUSE
pip wheel ./mapel-roommates --no-deps -w $WHL_HOUSE
pip wheel ./mapel-marriages --no-deps -w $WHL_HOUSE
ls ./$WHL_HOUSE # Listing the contents of ./$WHL_HOUSE for a sanity check
- name: Artifactize pure-python wheels and sdists
uses: actions/upload-artifact@v4
with:
name: ${{ env.MAPEL_REST_ARTS }}
path: ${{ env.WHL_HOUSE }}
build-compiled-python-wheels:
# The manylinyux action (the following one) runs everything as root. So it
# is not predicatble how this interacts with other actions (e.g., it might
# create a directory accessible only for root so that subsequent actions
# cannot use it).
# Hence, it is very convenient to thave this action in a separate job
# and publish the outcome as artifacts.
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Build mapel-elections wheels
uses: pypa/cibuildwheel@v2.20.0
env:
# We skip old versions of cPython, and all PyPy
# because the C++ extension is incompatible with PyPy
CIBW_SKIP: "cp36-* pp3*"
CIBW_BUILD_FRONTEND: "build"
with:
package-dir: 'mapel-elections'
output-dir: '${{ env.WHL_HOUSE }}'
- name: Artifactize compiled-python wheels
uses: actions/upload-artifact@v4
with:
name: ${{ env.MAPEL_EL_ARTS }}-${{ matrix.os }}
path: ${{ env.WHL_HOUSE }}
publish:
needs: [build-compiled-python-wheels, build-python-wheels-and-sdists]
name: Publishing to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.1.7
with:
path: ${{ env.WHL_HOUSE }}
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ env.WHL_HOUSE }}
# - name: Prepare the distrib directory
# run: |
# mv $MAPEL_EL_ARTS/* .
# mv $MAPEL_REST_ARTS/* .
# rm -r $MAPEL_EL_ARTS
# rm -r $MAPEL_REST_ARTS
# working-directory: ${{ env.WHL_HOUSE }}
- name: Display all artifacts
run: ls -R
working-directory: ${{ env.WHL_HOUSE }}
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ${{ env.WHL_HOUSE }}/
verbose: true