Repository navigation
157 lines (125 loc) · 3.73 KB
/
Copy pathtest.yml
File metadata and controls
157 lines (125 loc) · 3.73 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# This workflow is managed by gh actions-lock.
# SPDX-License-Identifier: MPL-2.0
# This workflow is managed by gh actions-lock.
name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
permissions:
actions: read
contents: read
jobs:
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
scandir: './src'
severity: warning
ignore_paths: tests
syntax-check:
name: Syntax Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- name: Check Bash Syntax
run: |
find . -name "*.sh" -type f -exec bash -n {} \;
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- name: Make scripts executable
run: |
chmod +x network-repair
chmod +x src/main.sh
chmod +x tests/*.sh
find src -name "*.sh" -exec chmod +x {} \;
- name: Run test suite
run: ./tests/run-tests.sh
- name: Run utility tests
run: ./tests/test-utils.sh
integration-tests:
name: Integration Tests - ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu:20.04
- ubuntu:22.04
- ubuntu:24.04
- debian:12
container:
image: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7.0.1
- name: Install dependencies
run: |
apt-get update
apt-get install -y iproute2 iputils-ping dnsutils curl sudo
- name: Make scripts executable
run: |
chmod +x network-repair
chmod +x src/main.sh
chmod +x tests/*.sh
find src -name "*.sh" -exec chmod +x {} \;
- name: Run diagnostics
run: ./network-repair diagnose || true
- name: Test help command
run: ./network-repair --help
- name: Test version command
run: ./network-repair --version
docker-test:
name: Docker Build Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- name: Create Dockerfile
run: |
cat > Dockerfile << 'EOF'
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \
iproute2 \
iputils-ping \
dnsutils \
curl \
sudo \
&& rm -rf /var/lib/apt/lists/*
COPY . /opt/network-repair
WORKDIR /opt/network-repair
RUN chmod +x network-repair src/main.sh
RUN find src -name "*.sh" -exec chmod +x {} \;
ENTRYPOINT ["/opt/network-repair/network-repair"]
CMD ["--help"]
EOF
- name: Build Docker image
run: docker build -t network-repair-test .
- name: Test in Docker
run: |
docker run --rm network-repair-test --help
docker run --rm network-repair-test --version
docker run --rm --network host network-repair-test diagnose || true
installation-test:
name: Installation Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- name: Make scripts executable
run: |
chmod +x install.sh
chmod +x network-repair
chmod +x src/main.sh
find src -name "*.sh" -exec chmod +x {} \;
- name: Test installation (dry-run)
run: |
# Test that install script syntax is valid
bash -n ./install.sh
# We can't actually install without root, but we can test the script
echo "Installation script syntax is valid"