This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (120 loc) · 4.75 KB
/
wheelie.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
132
133
134
135
136
name: Wheelie
on:
workflow_dispatch:
inputs:
PACKAGES:
jobs:
distro_matrix:
name: Set up the distro matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out repo
uses: actions/checkout@v2
- id: set-matrix
run: echo "::set-output name=matrix::$(cat distros.txt | jq -nRjc '[inputs | .]')"
build_wheels:
name: ${{ matrix.os }}-${{ matrix.arch }}
needs: distro_matrix
runs-on: ubuntu-latest
strategy:
matrix:
os: ${{fromJSON(needs.distro_matrix.outputs.matrix)}}
arch: [amd64, arm32v7, arm64v8]
steps:
- name: Check out repo
uses: actions/checkout@v2
# https://github.com/crazy-max/ghaction-docker-buildx/issues/172
- name: Hack Docker FS to Build cryptography on armv6/armv7
run: |
df -h
sudo swapon --show
sudo dd if=/dev/zero of=/swapfile1 bs=1M count=8K
sudo chmod 600 /swapfile1
sudo mkswap /swapfile1
sudo swapon /swapfile1
sudo swapon --show
sudo free -h
sudo systemctl stop docker
sudo mount -t tmpfs -o size=9G tmpfs /var/lib/docker
df -h
sudo systemctl start docker
- name: Set up qemu
run: |
case ${{ matrix.arch }} in
amd64)
QEMU_ARCH=
;;
arm32v7)
QEMU_ARCH=arm
;;
arm64v8)
QEMU_ARCH=aarch64
;;
esac
if [ -n "${QEMU_ARCH}" ]; then
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
#docker rm $(docker create --volume qemu-user-static:/usr/bin multiarch/qemu-user-static:${QEMU_ARCH} dummy)
#docker run --rm --privileged --volume qemu-user-static:/usr/bin:ro multiarch/qemu-user-static:register --persistent yes
fi
- name: Build wheels in image
run: |
DISTRO=$(echo ${{ matrix.os }} | awk -F'-' '{print $1}')
DISTROVER=$(echo ${{ matrix.os }} | awk -F'-' '{print $2}')
if [ "${{ matrix.arch }}" == "arm32v7" ]; then
echo "arm32 build detected, cloning crates.io index"
git clone --bare https://github.com/rust-lang/crates.io-index.git github.com-1285ae84e5963aae
else
mkdir -p github.com-1285ae84e5963aae
fi
docker build -t ${{ matrix.os }}-${{ matrix.arch }} --build-arg DISTRO=${DISTRO} --build-arg DISTROVER=${DISTROVER} --build-arg ARCH=${{ matrix.arch }} --build-arg PACKAGES="${{ github.event.inputs.PACKAGES }}" .
docker create --name ${{ matrix.os }}-${{ matrix.arch }} ${{ matrix.os }}-${{ matrix.arch }}
mkdir -p build
docker cp ${{ matrix.os }}-${{ matrix.arch }}:/build build
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-artifacts
path: build/*
upload_wheels:
name: Upload wheels
needs: build_wheels
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Upload artifacts
run: |
mkdir -p alpine ubuntu
for artifactfolder in $(ls -d alpine-*-artifacts); do
mv -f ${artifactfolder}/build/* alpine/
done
for artifactfolder in $(ls -d ubuntu-*-artifacts); do
mv -f ${artifactfolder}/build/* ubuntu/
done
for os in ubuntu alpine; do
for wheel in $(ls ${os}/); do
if ! grep -q "${wheel}" "docs/${os}/index.html" && ! echo "${wheel}" | grep -q "none-any"; then
echo "**** ${wheel} for ${os} is being uploaded to aws ****"
aws s3 cp ${os}/${wheel} s3://wheels.linuxserver.io/${os}/${wheel} --acl public-read
sed -i "s|</body>| <a href='https://wheels.linuxserver.io/${os}/${wheel}'>${wheel}</a>\n <br />\n\n</body>|" "docs/${os}/index.html"
else
echo "**** ${wheel} for ${os} already processed, skipping ****"
fi
done
done
rm -rf *-artifacts ubuntu alpine
git config --local user.email "[email protected]"
git config --local user.name "LinuxServer-CI"
git add . || :
git commit -m '[bot] Updating indices' || :
git push || :