forked from lf-edge/eve
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (93 loc) · 3.82 KB
/
publish.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
---
name: Publish
on:
push:
branches:
- "master"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
if: github.event.repository.full_name == 'lf-edge/eve'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [arm64-secure, ubuntu-20.04, ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine architecture prefix and ref
env:
REF: ${{ github.ref }}
run: |
# we are using ubuntu-latest as our riscv64 cross build machine
if [ "${{ matrix.os }}" = ubuntu-latest ]; then
APT_INSTALL="sudo apt install -y binfmt-support qemu-user-static"
# the following weird statement is here to speed up the happy path
# if the default server is responding -- we can skip apt update
$APT_INSTALL || { sudo apt update && $APT_INSTALL ; }
# we need to build our own version of cross-enabled linuxkit, while upstream is sorting things out
make LINUXKIT_VERSION=master LINUXKIT_SOURCE=https://github.com/rvs/linuxkit.git linuxkit
# constraining environment for riscv64 builds
TAG=lfedge/eve-alpine:81e6520f4f1554789eb1ac299168e72ac37d88e2-riscv64
echo "ZARCH=riscv64" >> "$GITHUB_ENV"
echo 'LK_BUILD_ARGS={"EVE_BUILDER_IMAGE":"'$TAG\"} >> "$GITHUB_ENV"
fi
echo "ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')" >> "$GITHUB_ENV"
echo "TAG=$(echo "$REF" | sed -e 's#^.*/##' -e 's#master#snapshot#' -e 's#main#snapshot#')" >> "$GITHUB_ENV"
- name: Login to DockerHUB
run: |
echo "${{ secrets.RELEASE_DOCKERHUB_TOKEN }}" |\
docker login -u "${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}" --password-stdin
- name: Build packages
run: |
# GH Actions convert our annotated tags into plain ones,
# so we need to convert it back (but only if it exists).
if [ -n "$(git tag)" ]; then
git config --global user.name "Edge Virtualization Engine"
git config --global user.email "eve@lfedge.org"
for t in $(git tag); do
git tag -a -m"Release $t" -f "$t" "$t"
done
fi
# sadly, our build sometimes times out on network access
# and running out of disk space: re-trying for 3 times
for i in 1 2 3; do
if make -e V=1 LINUXKIT_PKG_TARGET=push pkgs; then
break
else
# the most likely reason for 'make pkgs' to fail is
# the docker cache produced by the build exhausting
# disk space. So the following can't hurt before we
# retry:
docker rmi -f `docker image ls -q` || :
docker system prune -f || :
fi
done
- name: Build EVE for KVM
# build #1 without push (do not push either unless both can build)
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
rm -rf dist dist.xen
make -e V=1 HV=kvm eve
mv -f dist dist.xen
- name: Build and push EVE for Xen
# since build #1 works, build and push #2
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
make -e V=1 HV=xen LINUXKIT_PKG_TARGET=push eve
- name: Build and push EVE for KVM
# redo build #1 with push
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
rm -rf dist
mv -f dist.xen dist
make -e V=1 HV=kvm LINUXKIT_PKG_TARGET=push eve
- name: Build EVE for riscv64
# special HV for riscv64
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
rm -rf dist dist.xen
make -e V=1 HV=mini LINUXKIT_PKG_TARGET=push eve