-
-
Notifications
You must be signed in to change notification settings - Fork 316
131 lines (108 loc) · 3.8 KB
/
build-distributions.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
name: build distributions
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
PYTHON_VERSION: "3.12.3"
DIST_VERSION: "20240415"
DIST_URL: "https://github.com/indygreg/python-build-standalone/releases/download"
PYTHONDONTWRITEBYTECODE: "1"
# Some pip environment variables are weird, this means do not compile
PIP_NO_COMPILE: "0"
jobs:
distributions-linux:
name: ${{ matrix.job.target }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
job:
- image: quay.io/pypa/manylinux2014_x86_64
target: x86_64-unknown-linux-gnu
- image: quay.io/pypa/manylinux_2_28_aarch64
target: aarch64-unknown-linux-gnu
emulation: arm64
steps:
- name: Set up QEMU
if: matrix.job.emulation
uses: docker/setup-qemu-action@v3
- name: Set up Docker container
run: >-
docker run --rm -d
--name builder
--workdir /home
--env PYTHONDONTWRITEBYTECODE
--env PIP_NO_COMPILE
${{ matrix.job.image }}
sleep infinity
- name: Download distribution
run: >-
docker exec builder
curl -LO
${{ env.DIST_URL }}/${{ env.DIST_VERSION }}/cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Check original size
run: >-
docker exec builder
ls -lh cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Unpack distribution
run: >-
docker exec builder
tar xzf cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Install Hatch
run: >-
docker exec builder
/home/python/bin/python -m pip install hatch
- name: Archive distribution
run: >-
docker exec builder
tar czf ${{ matrix.job.target }}.tar.gz python
- name: Move to host
run: docker cp builder:/home/${{ matrix.job.target }}.tar.gz .
- name: Check final size
run: ls -lh ${{ matrix.job.target }}.tar.gz
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: distribution-${{ matrix.job.target }}
path: ${{ matrix.job.target }}.tar.gz
distributions-windows-macos:
name: ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- target: x86_64-pc-windows-msvc
os: windows-2019
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-apple-darwin
os: macos-12
steps:
- name: Download distribution
run: curl -LO ${{ env.DIST_URL }}/${{ env.DIST_VERSION }}/cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Check original size
run: ls -lh cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Unpack distribution
run: tar xzf cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Install Hatch
run: ${{ startsWith(matrix.job.os, 'windows-') && '.\\python\\python.exe' || './python/bin/python' }} -m pip install hatch
- name: Archive distribution
run: tar czf ${{ matrix.job.target }}.tar.gz python
- name: Check final size
run: ls -lh ${{ matrix.job.target }}.tar.gz
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: distribution-${{ matrix.job.target }}
path: ${{ matrix.job.target }}.tar.gz