-
Notifications
You must be signed in to change notification settings - Fork 293
176 lines (174 loc) · 7.44 KB
/
build.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: build
on:
workflow_call:
inputs:
repo:
type: string
required: true
ref:
type: string
required: true
name:
type: string
version:
type: string
arch:
type: string
required: true
compat-distro:
type: string
required: true
compat-distro-version:
type: string
required: true
kernel:
type: string
required: true
prefix:
type: string
artifact:
type: string
required: true
retention:
type: number
required: true
variant:
type: string
runner:
type: string
default: 'ubuntu-22.04'
jobs:
build:
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ inputs.repo }}
ref: ${{ inputs.ref }}
- name: Create cache directories
run: |
mkdir -p local-repositories petbuild-sources petbuild-cache petbuild-output
ln -s `pwd`/local-repositories ../local-repositories
- name: Get cached local-repositories
uses: actions/cache@v4
with:
path: local-repositories
key: local-repositories-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-${{ github.sha }}
restore-keys: |
local-repositories-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-
local-repositories-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-
- name: Prepare build environment
run: |
[ -f local-repositories/vercmp ] || (curl https://raw.githubusercontent.com/puppylinux-woof-CE/initrd_progs/master/pkg/w_apps_static/w_apps/vercmp.c | gcc -x c -o ../local-repositories/vercmp -)
sudo install -m 755 local-repositories/vercmp /usr/local/bin/vercmp
sudo install -D -m 644 woof-code/rootfs-skeleton/usr/local/petget/categories.dat /usr/local/petget/categories.dat
echo "dash dash/sh boolean false" | sudo debconf-set-selections
sudo DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
sudo ln -s bash /bin/ash
[ "${{ inputs.compat-distro }}" != void ] || echo "LD_LIBRARY_PATH=/lib:/usr/lib:/lib64:/usr/lib64" >> $GITHUB_ENV
- name: merge2out
timeout-minutes: 5
run: |
yes "" | sudo -E ./merge2out woof-distro/${{ inputs.arch }}/${{ inputs.compat-distro }}/${{ inputs.compat-distro-version }}
sudo chown -R root:root ../woof-out_*
- name: Set name
if: ${{ inputs.name != '' }}
run: sudo sed -i 's/^DISTRO_NAME=.*/DISTRO_NAME="${{ inputs.name }}"/' ../woof-out_*/DISTRO_SPECS
- name: Set version
if: ${{ inputs.version != '' }}
run: sudo sed -i s/^DISTRO_VERSION=.*/DISTRO_VERSION=${{ inputs.version }}/ ../woof-out_*/DISTRO_SPECS
- name: Set file name prefix
if: ${{ inputs.prefix != '' }}
run: sudo sed -i s/^DISTRO_FILE_PREFIX=.*/DISTRO_FILE_PREFIX=${{ inputs.prefix }}/ ../woof-out_*/DISTRO_SPECS
- name: Set variant
if: ${{ inputs.variant != '' }}
run: echo "DISTRO_VARIANT=${{ inputs.variant }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends dc debootstrap librsvg2-bin zstd xml2 syslinux-utils xorriso
[ ${{ inputs.compat-distro }} != devuan ] || curl https://git.devuan.org/devuan/debootstrap/raw/branch/master/scripts/ceres | sudo tee /usr/share/debootstrap/scripts/`echo ${{ inputs.compat-distro-version }} | sed s/64$//`
- name: 0setup
timeout-minutes: 10
run: |
cd ../woof-out_*
sudo -E ./0setup
- name: 1download
timeout-minutes: 120
run: |
cd ../woof-out_*
sudo -E ./1download
- name: 2createpackages
timeout-minutes: 30
run: |
cd ../woof-out_*
echo | sudo -E ./2createpackages
- name: Choose kernel variant
run: |
cd ../woof-out_*
. _00build.conf
[ ! -e _00build_2.conf ] || . _00build_2.conf
name="kernel-kit-output-usrmerge-${{ inputs.kernel }}-${{ inputs.arch }}"
[ "$USR_SYMLINKS" = yes ] || name="kernel-kit-output-${{ inputs.kernel }}-${{ inputs.arch }}"
echo "kernel_artifact=$name" >> $GITHUB_ENV
shell: bash
- name: Get cached kernel-kit output
uses: dawidd6/action-download-artifact@v6
with:
repo: puppylinux-woof-CE/woof-CE
branch: testing
workflow: ${{ startsWith(inputs.kernel, 'debian-') && 'dpup-kernel.yml' || (startsWith(inputs.kernel, 'ubuntu-') && 'upup-kernel.yml' || 'kernel-kit.yml') }}
workflow_conclusion: success
name: ${{ env.kernel_artifact }}
path: output
- name: Move cached kernel-kit output
run: sudo mv output ../woof-out_*/kernel-kit/
- name: Get cached petbuild-output
uses: actions/cache@v4
with:
path: petbuild-output
key: petbuild-output-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-${{ github.sha }}
restore-keys: |
petbuild-output-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-
petbuild-output-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-
- name: Get cached petbuild-cache
uses: actions/cache@v4
with:
path: petbuild-cache
key: petbuild-cache-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-${{ github.sha }}
restore-keys: |
petbuild-cache-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-
petbuild-cache-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-
- name: Get cached petbuild-sources
uses: actions/cache@v4
with:
path: petbuild-sources
key: petbuild-sources-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-${{ github.sha }}
restore-keys: |
petbuild-sources-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-${{ inputs.variant }}-
petbuild-sources-${{ inputs.arch }}-${{ inputs.compat-distro }}-${{ inputs.compat-distro-version }}-
petbuild-sources-${{ inputs.arch }}-${{ inputs.compat-distro }}-
petbuild-sources-${{ inputs.arch }}-
petbuild-sources-
- name: 3builddistro
timeout-minutes: 180
run: |
sudo chown -R root:root petbuild-{sources,cache,output}
sudo mv petbuild-{sources,cache,output} ../woof-out_*/
cd ../woof-out_*
sudo -E HOME=/root XDG_CONFIG_HOME=/root/.config ./3builddistro release
sudo chown -R --reference ~ petbuild-{sources,cache,output}
sudo mv petbuild-{sources,cache,output} $GITHUB_WORKSPACE/
- name: Move build output
run: |
for i in `ls ../woof-out_*/woof-output-*/*.{sfs,iso} 2>/dev/null`; do sudo mv -f $i .; done
sudo mv -f ../woof-out_*/kernel-kit/output/kernel_sources-*.sfs .
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact }}
path: |
*.iso
*.sfs
retention-days: ${{ inputs.retention }}