Skip to content

Commit 72a9bc2

Browse files
committed
Better control of environment variable for nektos act
1 parent a09f027 commit 72a9bc2

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

.actrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Nektos act runs tests as root. Without this environment variable
2+
# being set, CAPE exits at line 10 of web/web/settings.py,
3+
# and no tests are run.
4+
5+
--env CAPE_AS_ROOT=1

.github/workflows/python-package.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ jobs:
4040
run: poetry run ruff . --line-length 132 --ignore E501,E402
4141

4242
- name: Run unit tests
43-
# Nektos act runs tests as root;
44-
# and failing from line 10 on web/web/settings.py
45-
env:
46-
CAPE_AS_ROOT: 1
4743
run: poetry run python -m pytest --import-mode=append
4844

4945
- name: See if any parser changed

.github/workflows/yara-audit.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,4 @@ jobs:
3333
bash -c "poetry run ./extra/yara_installer.sh"
3434
3535
- name: Run unit tests
36-
# Nektos act runs tests as root;
37-
# and failing from line 10 on web/web/settings.py
38-
env:
39-
CAPE_AS_ROOT: 1
4036
run: poetry run pytest tests/test_yara.py -s --import-mode=append

docs/book/src/development/code_style.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,8 @@ save it as an input file.
198198
Example::
199199

200200
{
201-
"action": "push",
202201
"act": true,
203202
"repository" : {
204-
"id": 1,
205-
"full_name": "CAPEv2",
206203
"default_branch": "master"
207204
}
208205
}
@@ -215,6 +212,9 @@ and to run the actions that are scheduled::
215212

216213
gh act schedule -s GITHUB_TOKEN="$(gh auth token)" --eventpath /tmp/github-event.json
217214

215+
We created a file ``.actrc`` containing ``--env CAPE_AS_ROOT=1`` because ``act`` runs the tests
216+
as root, and otherwise the tests would exit saying you cannot run CAPE as root.
217+
218218
Poetry and pre-commit hooks
219219
===========================
220220

0 commit comments

Comments
 (0)