-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (35 loc) · 990 Bytes
/
test.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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y ufw curl shellcheck
- name: Run ShellCheck
run: |
shellcheck cloudflare-ufw-updater.sh
- name: Prepare environment for tests
run: |
# Mock UFW for testing
sudo mv /usr/sbin/ufw /usr/sbin/ufw.real || true
sudo touch /usr/sbin/ufw
sudo chmod +x /usr/sbin/ufw
- name: Run tests
run: |
# Run the script with test arguments
./cloudflare-ufw-updater.sh
./cloudflare-ufw-updater.sh --restore
- name: Restore environment
if: always()
run: |
# Restore original UFW
sudo mv /usr/sbin/ufw.real /usr/sbin/ufw || true