Skip to content

Commit

Permalink
Better control of environment variable for nektos act
Browse files Browse the repository at this point in the history
  • Loading branch information
rkoumis committed Mar 1, 2024
1 parent a09f027 commit 72a9bc2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Nektos act runs tests as root. Without this environment variable
# being set, CAPE exits at line 10 of web/web/settings.py,
# and no tests are run.

--env CAPE_AS_ROOT=1
4 changes: 0 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ jobs:
run: poetry run ruff . --line-length 132 --ignore E501,E402

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

- name: See if any parser changed
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/yara-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,4 @@ jobs:
bash -c "poetry run ./extra/yara_installer.sh"
- name: Run unit tests
# Nektos act runs tests as root;
# and failing from line 10 on web/web/settings.py
env:
CAPE_AS_ROOT: 1
run: poetry run pytest tests/test_yara.py -s --import-mode=append
6 changes: 3 additions & 3 deletions docs/book/src/development/code_style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,8 @@ save it as an input file.
Example::

{
"action": "push",
"act": true,
"repository" : {
"id": 1,
"full_name": "CAPEv2",
"default_branch": "master"
}
}
Expand All @@ -215,6 +212,9 @@ and to run the actions that are scheduled::

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

We created a file ``.actrc`` containing ``--env CAPE_AS_ROOT=1`` because ``act`` runs the tests
as root, and otherwise the tests would exit saying you cannot run CAPE as root.

Poetry and pre-commit hooks
===========================

Expand Down

0 comments on commit 72a9bc2

Please sign in to comment.