-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github/workflows: run pylint and pytest in a docker container
Create a new service for running unit tests based on the api service so that it includes the kernelci-core dependency. Signed-off-by: Ricardo Cañuelo <[email protected]>
- Loading branch information
Ricardo Cañuelo
committed
Jan 5, 2024
1 parent
93f1b42
commit a2455d6
Showing
2 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,24 +39,44 @@ jobs: | |
python -m pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
- name: Export environment variables | ||
run: | | ||
echo "SECRET_KEY=b6451545d2e4635148d768f07877aade3ad8e7e160d52962badd7587a4b9a150" > .env | ||
echo "SMTP_HOST=smtp.gmail.com" >> .env | ||
echo "SMTP_PORT=465" >> .env | ||
echo "[email protected]" >> .env | ||
echo "EMAIL_PASSWORD=random" >> .env | ||
- name: Build docker images | ||
run: docker-compose -f test-docker-compose.yaml build | ||
|
||
- name: Run pycodestyle | ||
run: | | ||
pycodestyle api/*.py | ||
- name: Run API containers | ||
run: | | ||
docker-compose -f test-docker-compose.yaml up -d unit_test | ||
- name: Run pylint | ||
run: | | ||
pylint api.auth | ||
pylint api.db | ||
pylint api.main | ||
pylint api.models | ||
pylint api.pubsub | ||
pylint api.user_manager | ||
pylint api.user_models | ||
pylint tests/unit_tests | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.auth | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.db | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.main | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.models | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.pubsub | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.user_manager | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint api.user_models | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pylint tests/unit_tests | ||
- name: Run pytest | ||
run: | | ||
SECRET_KEY=b6451545d2e4635148d768f07877aade3ad8e7e160d52962badd7587a4b9a150 SMTP_HOST=smtp.gmail.com SMTP_PORT=465 [email protected] EMAIL_PASSWORD=random pytest -vs tests/unit_tests/ | ||
docker-compose -f test-docker-compose.yaml exec --no-tty unit_test pytest -vs tests/unit_tests/ | ||
- name: Stop docker containers | ||
if: always() | ||
run: | | ||
docker-compose -f test-docker-compose.yaml down | ||
lint: | ||
runs-on: ubuntu-22.04 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters