-
-
Notifications
You must be signed in to change notification settings - Fork 138
216 lines (215 loc) · 8.19 KB
/
tests.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: tests
on:
pull_request: {}
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
defaults:
run:
shell: bash
jobs:
test-on-ubuntu:
strategy:
matrix:
OS: ["ubuntu:latest", "ubuntu:devel", "ubuntu:rolling"]
PACSTALL_VERSION: ["master", "develop"]
fail-fast: false
runs-on: ubuntu-latest
container:
image: ${{ matrix.OS }}
env:
TERM: xterm
shell: bash
USER: dio
LOGNAME: dio
DEBIAN_FRONTEND: noninteractive
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
- id: checkout
uses: actions/checkout@v4
- id: paths
uses: dorny/paths-filter@v2
with:
filters: |
pacscripts:
- 'packages/*/*.pacscript'
- id: files
uses: masesgroup/retrieve-changed-files@v3
- name: Check for Pacscript changes
run: |
touch .no-pacscript-changes
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ ${changed_file} == *".pacscript" ]]; then
rm -f .no-pacscript-changes
break
fi
done
- name: Install System Utilities
if: steps.paths.outputs.pacscripts == 'true'
run: |
dpkg --add-architecture i386
dpkg --add-architecture arm64
sed -i 's/deb http/deb [arch=amd64\,i386] http/g' /etc/apt/sources.list
sed -e 's/amd64\,i386/arm64/g' -e 's/archive\.ubuntu/ports\.ubuntu/g' -e 's/security\.ubuntu/ports\.ubuntu/g' -e 's/\.com\/ubuntu/\.com\/ubuntu-ports/g' /etc/apt/sources.list | tee /etc/apt/sources.list.d/arm64.list
apt-get update
apt-get install apt-utils curl bash wget git sudo iputils-ping keyboard-configuration lsb-release desktop-file-utils -y
ln -fs /usr/share/zoneinfo/Africa/Libreville /etc/localtime
- name: Setup Test User
if: steps.paths.outputs.pacscripts == 'true'
run: |
useradd -rm -d /home/$USER -s /bin/bash -g root -G sudo -u 1001 $USER
sudo sed -i "s/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL) NOPASSWD:ALL/g" /etc/sudoers
chown -R $USER /tmp
chmod -R 777 /tmp
- name: Installing Pacstall
if: steps.paths.outputs.pacscripts == 'true'
run: |
export SUDO_USER=$USER
curl -fsSL https://pacstall.dev/q/install\?dnt > pacstall-install.sh || curl -fsSL https://git.io/JsADh > pacstall-install.sh
chmod +x ./pacstall-install.sh
echo N\n | sudo -E ./pacstall-install.sh
rm ./pacstall-install.sh
pacstall -U pacstall ${{ matrix.PACSTALL_VERSION }}
ls -lad /tmp/pacstall
shell: sudo -E -u dio bash {0}
env:
SUDO_USER: dio
- name: Installing Packages
if: steps.paths.outputs.pacscripts == 'true'
run: |
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ ${changed_file} == *".pacscript" ]]; then
pacscript_file=`basename "${changed_file}"`
package_name="${pacscript_file/.pacscript/ }"
package_dir=`dirname "${changed_file}"`
echo "Running pacstall -I for ${package_name}..."
echo "pacstall -I ${package_name}"
pushd ${package_dir}
pacstall --disable-prompts -I ${pacscript_file} || exit 1
popd
fi
done
shell: sudo -E -u dio bash {0}
env:
DEBIAN_FRONTEND: noninteractive
- name: Uninstalling Packages
if: steps.paths.outputs.pacscripts == 'true'
run: |
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
for changed_file in $(pacstall -L); do
echo "Running pacstall -R for ${changed_file}..."
pacstall --disable-prompts -R ${changed_file} || exit 1
done
shell: sudo -E -u dio bash {0}
env:
DEBIAN_FRONTEND: noninteractive
test-on-debian:
strategy:
matrix:
OS: ["debian:stable", "debian:testing", "debian:unstable"]
PACSTALL_VERSION: ["master", "develop"]
fail-fast: false
runs-on: ubuntu-latest
container:
image: ${{ matrix.OS }}
env:
TERM: xterm
shell: bash
USER: dio
LOGNAME: dio
DEBIAN_FRONTEND: noninteractive
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
- id: checkout
uses: actions/checkout@v4
- id: paths
uses: dorny/paths-filter@v2
with:
filters: |
pacscripts:
- 'packages/*/*.pacscript'
- id: files
uses: masesgroup/retrieve-changed-files@v3
- name: Check for Pacscript changes
run: |
touch .no-pacscript-changes
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ ${changed_file} == *".pacscript" ]]; then
rm -f .no-pacscript-changes
break
fi
done
- name: Install System Utilities
if: steps.paths.outputs.pacscripts == 'true'
run: |
dpkg --add-architecture i386
dpkg --add-architecture arm64
apt-get update
apt-get install apt-utils curl bash wget git sudo iputils-ping keyboard-configuration lsb-release desktop-file-utils -y
ln -fs /usr/share/zoneinfo/Africa/Libreville /etc/localtime
- name: Setup Test User
if: steps.paths.outputs.pacscripts == 'true'
run: |
useradd -rm -d /home/$USER -s /bin/bash -g root -G sudo -u 1001 $USER
sudo sed -i "s/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL) NOPASSWD:ALL/g" /etc/sudoers
chown -R $USER /tmp
chmod -R 777 /tmp
- name: Installing Pacstall
if: steps.paths.outputs.pacscripts == 'true'
run: |
export SUDO_USER=$USER
curl -fsSL https://pacstall.dev/q/install\?dnt > pacstall-install.sh || curl -fsSL https://git.io/JsADh > pacstall-install.sh
chmod +x ./pacstall-install.sh
echo N\n | sudo -E ./pacstall-install.sh
rm ./pacstall-install.sh
pacstall -U pacstall ${{ matrix.PACSTALL_VERSION }}
ls -lad /tmp/pacstall
shell: sudo -E -u dio bash {0}
env:
SUDO_USER: dio
- name: Installing Packages
if: steps.paths.outputs.pacscripts == 'true'
run: |
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ ${changed_file} == *".pacscript" ]]; then
pacscript_file=`basename "${changed_file}"`
package_name="${pacscript_file/.pacscript/ }"
package_dir=`dirname "${changed_file}"`
echo "Running pacstall -I for ${package_name}..."
echo "pacstall -Il ${package_name}"
pushd ${package_dir}
pacstall --disable-prompts -I ${pacscript_file} || exit 1
popd
fi
done
shell: sudo -E -u dio bash {0}
env:
DEBIAN_FRONTEND: noninteractive
- name: Uninstalling Packages
if: steps.paths.outputs.pacscripts == 'true'
run: |
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
for changed_file in $(pacstall -L); do
echo "Running pacstall -R for ${changed_file}..."
pacstall --disable-prompts -R ${changed_file} || exit 1
done
shell: sudo -E -u dio bash {0}
env:
DEBIAN_FRONTEND: noninteractive