Skip to content

Commit 3a67791

Browse files
Add loongarch64-linux support
Signed-off-by: 吴小白 <[email protected]>
1 parent 383aa56 commit 3a67791

22 files changed

+245
-414
lines changed

.github/workflows/linux.yml

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
if: ${{ needs.generate-matrix.outputs.pythonbuild_changed == 'true' || needs.generate-matrix.outputs.any_builds == 'true' || github.ref == 'refs/heads/main' }}
1818
needs:
1919
- generate-matrix
20-
runs-on: depot-ubuntu-22.04
20+
runs-on: ubuntu-22.04
2121
steps:
2222
- name: Install System Dependencies
2323
run: |
@@ -56,12 +56,9 @@ jobs:
5656
fail-fast: false
5757
matrix:
5858
image:
59-
- build
60-
- build.cross
61-
- build.cross-riscv64
62-
- gcc
59+
- build.cross-loongarch64
6360
name: ${{ matrix.image }}
64-
runs-on: depot-ubuntu-22.04
61+
runs-on: ubuntu-22.04
6562
permissions:
6663
packages: write
6764
steps:
@@ -277,103 +274,3 @@ jobs:
277274
with:
278275
name: cpython-${{ matrix.python }}-${{ matrix.target_triple }}-${{ matrix.build_options }}
279276
path: dist/*
280-
281-
build-1:
282-
needs:
283-
- generate-matrix
284-
- pythonbuild
285-
- image
286-
# Permissions used for actions/attest-build-provenance
287-
permissions:
288-
id-token: write
289-
attestations: write
290-
runs-on: ${{ matrix.runner }}
291-
strategy:
292-
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix-1) }}
293-
fail-fast: false
294-
name: ${{ matrix.target_triple }} / ${{ matrix.python }} / ${{ matrix.build_options }}
295-
steps:
296-
- uses: actions/checkout@v4
297-
with:
298-
fetch-depth: 0
299-
300-
- name: Install Python
301-
uses: actions/setup-python@v5
302-
with:
303-
python-version: '3.11'
304-
305-
- name: Download pythonbuild
306-
uses: actions/download-artifact@v4
307-
with:
308-
name: pythonbuild
309-
path: build
310-
311-
- name: Download images
312-
uses: actions/download-artifact@v4
313-
with:
314-
pattern: image-*
315-
path: build
316-
merge-multiple: true
317-
318-
- name: Cache downloads
319-
uses: actions/cache@v4
320-
with:
321-
path: build/downloads
322-
key: ${{ matrix.target_triple }}-${{ hashFiles('pythonbuild/downloads.py')}}
323-
restore-keys: |
324-
${{ matrix.target_triple }}-${{ hashFiles('pythonbuild/downloads.py')}}
325-
${{ matrix.target_triple }}-
326-
327-
- name: Load Docker Images
328-
run: |
329-
for f in build/image-*.tar.zst; do
330-
echo "decompressing $f"
331-
zstd -d --rm ${f}
332-
done
333-
334-
for f in build/image-*.tar; do
335-
echo "loading $f"
336-
docker load --input $f
337-
done
338-
339-
- name: Build
340-
if: ${{ ! matrix.dry-run }}
341-
run: |
342-
# Do empty target so all generated files are touched.
343-
./build-linux.py --make-target empty
344-
345-
# Touch mtimes of all images so they are newer than autogenerated files above.
346-
touch build/image-*
347-
348-
./build-linux.py --target-triple ${{ matrix.target_triple }} --python cpython-${{ matrix.python }} --options ${{ matrix.build_options }}
349-
350-
- name: Validate Distribution
351-
if: ${{ ! matrix.dry-run }}
352-
run: |
353-
chmod +x build/pythonbuild
354-
355-
if [ "${{ matrix.run }}" == "true" ]; then
356-
if [ "${{ matrix.libc }}" == "musl" ]; then
357-
sudo apt install musl-dev
358-
359-
# GitHub's setup-python action sets `LD_LIBRARY_PATH` which overrides `RPATH`
360-
# as used in the musl builds.
361-
unset LD_LIBRARY_PATH
362-
fi
363-
EXTRA_ARGS="--run"
364-
fi
365-
366-
build/pythonbuild validate-distribution ${EXTRA_ARGS} dist/*.tar.zst
367-
368-
- name: Generate attestations
369-
uses: actions/attest-build-provenance@v2
370-
if: ${{ github.ref == 'refs/heads/main' }}
371-
with:
372-
subject-path: dist/*
373-
374-
- name: Upload Distribution
375-
if: ${{ ! matrix.dry-run }}
376-
uses: actions/upload-artifact@v4
377-
with:
378-
name: cpython-${{ matrix.python }}-${{ matrix.target_triple }}-${{ matrix.build_options }}
379-
path: dist/*

Justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ release-download-distributions token commit:
3232

3333
# Upload release artifacts to a GitHub release.
3434
release-upload-distributions token datetime tag:
35-
cargo run --release -- upload-release-distributions --token {{token}} --datetime {{datetime}} --tag {{tag}} --dist dist
35+
cargo run --release -- upload-release-distributions --token {{token}} --datetime {{datetime}} --tag {{tag}} --dist dist --ignore-missing
3636

3737
# "Upload" release artifacts to a GitHub release in dry-run mode (skip upload).
3838
release-upload-distributions-dry-run token datetime tag:
@@ -96,7 +96,7 @@ release-run token commit tag:
9696

9797
rm -rf dist
9898
just release-download-distributions {{token}} {{commit}}
99-
datetime=$(ls dist/cpython-3.10.*-x86_64-unknown-linux-gnu-install_only-*.tar.gz | awk -F- '{print $8}' | awk -F. '{print $1}')
99+
datetime=$(ls dist/cpython-3.10.*-loongarch64-unknown-linux-gnu-install_only-*.tar.gz | awk -F- '{print $8}' | awk -F. '{print $1}')
100100
just release-upload-distributions {{token}} ${datetime} {{tag}}
101101
just release-set-latest-release {{tag}}
102102

@@ -107,7 +107,7 @@ release-dry-run token commit tag:
107107

108108
rm -rf dist
109109
just release-download-distributions {{token}} {{commit}}
110-
datetime=$(ls dist/cpython-3.10.*-x86_64-unknown-linux-gnu-install_only-*.tar.gz | awk -F- '{print $8}' | awk -F. '{print $1}')
110+
datetime=$(ls dist/cpython-3.10.*-loongarch64-unknown-linux-gnu-install_only-*.tar.gz | awk -F- '{print $8}' | awk -F. '{print $1}')
111111
just release-upload-distributions-dry-run {{token}} ${datetime} {{tag}}
112112

113113
_download-stats mode:

ci-runners.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
# Describes the runners that the CI system can use
22

3-
depot-ubuntu-22.04:
4-
arch: x86_64
5-
platform: linux
6-
free: false
3+
# depot-ubuntu-22.04:
4+
# arch: x86_64
5+
# platform: linux
6+
# free: false
77

88
# TODO: Enable this runner to perform native builds for aarch64
99
# depot-ubuntu-22.04-arm:
1010
# arch: aarch64
1111
# platform: linux
1212
# free: false
1313

14+
ubuntu-22.04:
15+
arch: x86_64
16+
platform: linux
17+
free: true
18+
19+
ubuntu-22.04-arm:
20+
arch: aarch64
21+
platform: linux
22+
free: true
23+
1424
depot-macos-latest:
1525
arch: x86_64
1626
platform: darwin

0 commit comments

Comments
 (0)