-
Notifications
You must be signed in to change notification settings - Fork 302
122 lines (110 loc) · 3.6 KB
/
test-install-script.yml
File metadata and controls
122 lines (110 loc) · 3.6 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
name: Test Install Script
on:
push:
branches:
- master
paths:
- "installTorrServerLinux.sh"
- ".github/workflows/test-install-script.yml"
- ".github/scripts/test-install-script.sh"
pull_request:
branches:
- master
paths:
- "installTorrServerLinux.sh"
- ".github/workflows/test-install-script.yml"
- ".github/scripts/test-install-script.sh"
workflow_dispatch:
# OSes that require version 135 due to glibc < 2.32
# Version 136+ requires glibc >= 2.32
env:
GLIBC_LIMITED_OSES: "debian-11|almalinux-8|rocky-8|amazonlinux-2"
MAX_RETRIES: "3"
RETRY_DELAY: "60"
jobs:
test-script-syntax:
name: Test Script Syntax
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Test script syntax
run: |
chmod +x installTorrServerLinux.sh
bash -n installTorrServerLinux.sh
echo "✓ Script syntax is valid"
- name: Test help command
run: |
./installTorrServerLinux.sh --help > /dev/null
./installTorrServerLinux.sh help > /dev/null
echo "✓ Help command works"
test-install-script:
name: Test on ${{ matrix.os }} (${{ matrix.test-user }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- ubuntu-24.04
- debian-11
- debian-12
- debian-13
- fedora-latest
- almalinux-8
- almalinux-9
- almalinux-10
- rocky-8
- rocky-9
- rocky-10
- amazonlinux-2
test-user: [root, default]
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get Docker image for OS
id: get-image
run: |
# Map OS to Docker image
case "${{ matrix.os }}" in
ubuntu-22.04) IMAGE="ubuntu:22.04" ;;
ubuntu-24.04) IMAGE="ubuntu:24.04" ;;
debian-11) IMAGE="debian:11" ;;
debian-12) IMAGE="debian:12" ;;
debian-13) IMAGE="debian:13" ;;
fedora-latest) IMAGE="fedora:latest" ;;
almalinux-8) IMAGE="almalinux:8" ;;
almalinux-9) IMAGE="almalinux:9" ;;
almalinux-10) IMAGE="almalinux:10" ;;
rocky-8) IMAGE="rockylinux/rockylinux:8" ;;
rocky-9) IMAGE="rockylinux/rockylinux:9" ;;
rocky-10) IMAGE="rockylinux/rockylinux:10" ;;
amazonlinux-2) IMAGE="amazonlinux:2" ;;
*)
echo "Warning: Unknown OS ${{ matrix.os }}, using ubuntu:22.04 as default"
IMAGE="ubuntu:22.04"
;;
esac
echo "image=$IMAGE" >> $GITHUB_OUTPUT
echo "Using Docker image: $IMAGE for OS: ${{ matrix.os }}"
- name: Run tests in container
run: |
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
--privileged \
-e MATRIX_OS="${{ matrix.os }}" \
-e TEST_USER="${{ matrix.test-user }}" \
-e GLIBC_LIMITED_OSES="${{ env.GLIBC_LIMITED_OSES }}" \
-e MAX_RETRIES="${{ env.MAX_RETRIES }}" \
-e RETRY_DELAY="${{ env.RETRY_DELAY }}" \
"${{ steps.get-image.outputs.image }}" \
bash -c "
set -e
# Make test script executable
chmod +x .github/scripts/test-install-script.sh
# Run the test script
.github/scripts/test-install-script.sh
"