-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (106 loc) · 3.67 KB
/
default.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
name: default
on: [push]
jobs:
sdist:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
- name: Build sdist
run: |
python setup.py sdist
ls -lh dist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-src
path: dist
bdist_wheel:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
pyver: [cp312-cp312]
arch: [x86_64, aarch64]
env:
py: /opt/python/${{ matrix.pyver }}/bin/python
img: quay.io/pypa/manylinux2014_${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Show available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
- name: Install dependencies
run: |
sudo apt install -y xz-utils
docker pull ${{ env.img }}
# for host env
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/build.txt
python -m pip install -U -e .
# for arch-specific env
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws ${{ env.img }} \
${{ env.py }} -m pip install -U pip setuptools wheel
- name: Build wheel
run: |
python scripts/build.py --arch ${{ matrix.arch }}
sed -i 's/ARCH/${{ matrix.arch }}/g' MANIFEST.in
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws ${{ env.img }} \
${{ env.py }} setup.py bdist_wheel
PKGVER=$(python -c 'from ai.backend.krunner.static_gnu import __version__; print(__version__, end="")')
GLIBC_PTAG=manylinux2014_${{ matrix.arch }} # to allow installing the krunner wheel when running Backend.AI on manylinux
MUSL_PTAG=musllinux_1_1_${{ matrix.arch }} # to allow installing the krunner wheel when running Backend.AI on musllinux
case "${{ matrix.arch }}" in # to allow installing the krunner wheel when running Backend.AI on macOS
"aarch64")
MACOS_PTAG=macosx_11_0_arm64 ;;
*)
MACOS_PTAG=macosx_11_0_${{ matrix.arch }} ;;
esac
sudo mv dist/backend.ai_krunner_static_gnu-${PKGVER}-*.whl \
dist/backend.ai_krunner_static_gnu-${PKGVER}-py3-none-${GLIBC_PTAG}.${MUSL_PTAG}.${MACOS_PTAG}.whl
ls -lh dist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.pyver }}-${{ matrix.arch }}
path: dist
deploy-to-pypi:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [sdist, bdist_wheel]
environment:
name: deploy-to-pypi
url: https://pypi.org/p/backend.ai-krunner-static-gnu
permissions:
id-token: write
runs-on: ubuntu-20.04
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- name: >-
Publish 🐍📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1