-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (114 loc) · 3.79 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
117
118
119
120
121
122
123
124
name: default
on: [push]
jobs:
sdist:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- 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@v2
with:
name: dist
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-20.04]
pyver: [cp311-cp311]
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@v3
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
- 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@v2
with:
name: dist
path: dist
publish:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [sdist, bdist_wheel]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U twine
- name: Download distributions
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*