forked from qemu-bsd-user/qemu-bsd-user
-
-
Notifications
You must be signed in to change notification settings - Fork 4
143 lines (126 loc) · 4.24 KB
/
bsd-user.yml
File metadata and controls
143 lines (126 loc) · 4.24 KB
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
137
138
139
140
141
142
143
name: Build, Test & Publush
# Controls when the action will run.
on:
# Triggers the workflow on all push or pull request events
push:
pull_request:
release:
types: [created]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
# added using https://github.com/step-security/secure-repo
permissions:
contents: read
jobs:
build_in_docker:
name: Build&Push to Registry
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
base_image: ['debian:12-slim', 'debian:13-slim', 'ubuntu:latest']
env:
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/qemu-bsd-user-l4b
BASE_IMAGE: ${{ matrix.base_image }}
steps:
- name: Maximize build space
if: ${{ inputs.maximize_space }}
shell: sh -x -e {0}
run: |
echo "Memory and swap:"
sudo free -h
echo
sudo swapon --show
echo
echo "Available storage:"
sudo df -h
echo
PIDS=""
for d in /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
do
sudo rm -rf "${d}" &
PIDS="${PIDS} ${!}"
done
sudo docker image prune --all --force &
PIDS="${PIDS} ${!}"
for pid in ${PIDS}
do
wait ${pid}
done
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set dynamic environment
run: |
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
OS_TAG="`echo ${{ env.BASE_IMAGE }} | sed 's|:|-|g'`"
# linux/arm/v7 is missing latest clang
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
sort -u | ./bsd-user/scripts/ci/get-arch-buildargs fltplatforms | paste -sd ','`"
if [ ! -n "${PLATFORMS}" ]
then
echo "Cannot get list of platforms supported by the ${{ env.BASE_IMAGE }}." >&2
exit 1
fi
MYREL="`cat /etc/debian_version | awk -F . '{print $1}'`"
if [ "${BASE_IMAGE%-*}" = "debian:13" ]
then
CLANG_VER=21
else
CLANG_VER=19
fi
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
echo "OS_TAG=${OS_TAG}" >> $GITHUB_ENV
echo "CLANG_VER=${CLANG_VER}" >> $GITHUB_ENV
echo "BUILD_IMAGE=${{ env.GHCR_REPO }}:latest-${OS_TAG}" >> $GITHUB_ENV
- name: Build L4B Qemu container image
uses: docker/build-push-action@v6
env:
CACHE_SPEC: "type=registry,ref=${{ env.GHCR_REPO }}:${{ env.GIT_BRANCH }}-${{ env.OS_TAG}}-buildcache"
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./bsd-user/scripts/ci/Dockerfile
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
CLANG_VER=${{ env.CLANG_VER }}
tags: ${{ env.BUILD_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: ${{ env.CACHE_SPEC }}
cache-to: ${{ env.CACHE_SPEC }},mode=max
- name: Register FreeBSD binfmt
run: |
docker run --rm --privileged ${{ env.BUILD_IMAGE }}
- name: Build FreeBSD/base container image
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: ./bsd-user/scripts/ci
file: ./bsd-user/scripts/ci/Dockerfile.FreeBSD_base
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
BUILD_IMAGE=${{ env.BUILD_IMAGE }}
tags: "${{ env.BUILD_IMAGE }}-freebsd143"
platforms: ${{ env.PLATFORMS }}
pull: true
push: true