-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (117 loc) · 3.76 KB
/
build-test.yaml
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
name: Build and test
on:
push:
schedule:
- cron: "0 0 7 * *"
jobs:
ubuntu:
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
env:
ARCH: ubuntu2204
UNPRIVILEGED: ubuntu
TEST_OUTPUT_DIR: /tmp/tests
WORKDIR: /tmp/workdir
steps:
- name: Install minimal dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends git sudo gettext-base ca-certificates
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create an unprivileged user
run: |
useradd -m $UNPRIVILEGED
chown -R $UNPRIVILEGED:$UNPRIVILEGED .
echo "$UNPRIVILEGED ALL = NOPASSWD: $(which apt-get)" | tee -a /etc/sudoers
- name: Build package
run: sudo -u $UNPRIVILEGED --preserve-env=WORKDIR env SUDO=sudo build/ubuntu/mk
- name: Archive source package
uses: actions/upload-artifact@v4
with:
name: source-package.${{github.sha}}.${{env.ARCH}}
retention-days: 7
path: build/ubuntu/out/*.tar
- name: Install package
run: apt-get install -y ./build/ubuntu/out/*.deb
- name: Test system installation
run: |
export TOOLS=$(readlink -f "$WORKDIR"/*/tools)
run() {
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS \
env SUT=$(which $1) SHOW_IDS=1 \
tools/test-harness -c $1
}
run hlua
run hpython
run hnode
run hsh
- name: Archive test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: tests.${{github.sha}}.${{env.ARCH}}
retention-days: 7
path: "${{env.TEST_OUTPUT_DIR}}/*-tests-*.tar.gz"
archlinux:
runs-on: ubuntu-22.04
container:
image: archlinux:latest
env:
ARCH: archlinux
UNPRIVILEGED: arch
TEST_OUTPUT_DIR: /tmp/tests
steps:
- name: Install minimal dependencies
run: pacman -Suy --noconfirm base-devel wget git
# workaround for upstream nodejs package does not include libnode.so
# https://gitlab.archlinux.org/archlinux/packaging/packages/nodejs/-/issues/1
- name: Install nodejs-shared
env:
GH_TOKEN: ${{github.token}}
run: |
pacman -S --noconfirm github-cli
gh --repo rootmos/nodejs-shared release download --pattern "nodejs-shared*x86_64*"
pacman --noconfirm -U nodejs-shared*x86_64*
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create an unprivileged user
run: |
useradd -m $UNPRIVILEGED
chown -R $UNPRIVILEGED:$UNPRIVILEGED .
tee -a /etc/sudoers.d/$UNPRIVILEGED <<< "$UNPRIVILEGED ALL = NOPASSWD: $(which pacman)"
- name: Create PKGBUILD
run: sudo -u $UNPRIVILEGED build/archlinux/mk
- name: Archive PKGBUILD
uses: actions/upload-artifact@v4
with:
name: PKGBUILD.${{github.sha}}
retention-days: 7
path: "build/archlinux/PKGBUILD"
- name: Build package
run: sudo -u $UNPRIVILEGED makepkg -si --noconfirm
working-directory: build/archlinux
- name: Test system installation
run: |
export TOOLS=$(readlink -f build/archlinux/src/*/tools)
run() {
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS \
env SUT=$(which $1) SHOW_IDS=1 \
tools/test-harness -c $1
}
run hlua
run hpython
run hnode
run hsh
- name: Archive test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: tests.${{github.sha}}.${{env.ARCH}}
retention-days: 7
path: "${{env.TEST_OUTPUT_DIR}}/*-tests-*.tar.gz"