-
Notifications
You must be signed in to change notification settings - Fork 40
118 lines (105 loc) · 3.42 KB
/
pytest.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
---
# yamllint disable rule:line-length
name: "Test Suite"
"on":
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
pytest-ubuntu:
name: Pytest-Ubuntu
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: prepare environment
env:
HTTPS_SUPPORT: true
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq --yes
sudo apt-get install python3-pip --yes
sudo --preserve-env=HTTPS_SUPPORT sh helper/install_deps.sh
# install via sudo to run pytest as root - see below
sudo pip install -r ./tests/requirements.txt
sudo systemctl disable --now privoxy || true
- name: run pytest
env:
ACTIONS_STEP_DEBUG: ${{ vars.ACTIONS_STEP_DEBUG }}
RUNNER_DEBUG: ${{ runner.debug }}
run: |
sudo pkill -9 privoxy || true
# run pytest as sudo to allow pytestshellutils to stop privoxy
sudo --preserve-env=ACTIONS_STEP_DEBUG,RUNNER_DEBUG pytest -v -s --color yes tests/
pytest-alpine:
name: Pytest-Alpine
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
container:
image: alpine:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: prepare environment
run: |
apk add --no-cache --quiet build-base linux-headers py3-pip python3-dev
python3 -m venv .venv
. .venv/bin/activate
pip install --no-cache-dir -qr tests/requirements.txt
sh helper/install_deps.sh
bash -c "for f in /etc/privoxy/*.new; do cp -p \$f \${f%.*};done"
- name: run pytest
env:
ACTIONS_STEP_DEBUG: ${{ vars.ACTIONS_STEP_DEBUG }}
RUNNER_DEBUG: ${{ runner.debug }}
run: |
. .venv/bin/activate
pytest -v -s --color yes tests/
pytest-openwrt:
name: Pytest-OpenWRT
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
container:
image: openwrt/rootfs:x86-64-23.05.3
steps:
- name: Prepare OPKG
run: |
mkdir -p /var/lock /var/run
opkg update
- name: Checkout repository (custom)
# required as 'node dist/index.js' succeeds with errors
continue-on-error: true
env:
INPUT_TOKEN: ${{ github.token }}
run: |
set -x
opkg install git-http node-npm
git clone -b "v4" https://github.com/actions/checkout.git /tmp/checkout
cd /tmp/checkout
npm install
node dist/index.js
echo "end: $?"
ls -l "${GITHUB_WORKSPACE}"
- name: prepare environment
run: |
opkg install curl gcc make python3 python3-pip python3-dev
pip install --no-cache-dir -qr tests/requirements.txt
sh helper/install_deps.sh
/etc/rc.d/K10privoxy stop || true
echo " list listen_address '127.0.0.1:8118'" >> /etc/config/privoxy
echo " list permit_access '127.0.0.0/24'" >> /etc/config/privoxy
- name: run pytest
env:
ACTIONS_STEP_DEBUG: ${{ vars.ACTIONS_STEP_DEBUG }}
RUNNER_DEBUG: ${{ runner.debug }}
run: |
pytest -v -s --color yes tests/