Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Run BATS test in pipeline #403

Merged
merged 5 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ jobs:
pip install poetry
poetry install

- name: Install BATS for e2e tests
uses: bats-core/bats-action@1.5.4

- name: Run Tests
env:
BATS_LIBS_ROOT: /usr/lib
run: |
poetry run poe precommit
poetry run poe coverage
poetry run secureli build
poetry run poe e2e


secureli-release-noop:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
- uses: morrisoncole/pr-lint-action@v1.7.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
title-regex: "(chore|style|test|feat|fix|docs): .+"
title-regex: "(chore|style|test|feat|fix|docs|ci): .+"
on-failed-regex-fail-action: true
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ install = "poetry install"
lint = "black --check ."
precommit = "pre-commit run -a"
test = ["init", "lint", "coverage_run", "coverage_report"]
e2e = "bats tests/end-to-end/test.bats"
e2e = "bats --verbose-run tests/end-to-end/test.bats"

[tool.poetry.dependencies]
# Until `python-dependency-injector` supports python 3.12, restrict to python 3.11 and lower
Expand Down
8 changes: 4 additions & 4 deletions tests/end-to-end/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ setup() {

@test "can run secureli init" {
run python secureli/main.py init -ry
assert_output --partial 'seCureLI has not been setup yet.'
assert_output --partial 'seCureLI has been installed successfully (language = Python)'
assert_output --partial 'Hooks successfully updated to latest version'
assert_output --partial 'seCureLI has been installed successfully'
}

@test "can run secureli scan" {
run python secureli/main.py scan -y
assert_output --partial 'Scan executed successfully and detected no issues!'
run python secureli/main.py scan -y -m all-files
assert_output --partial 'Detected the following language(s):'
}
Loading