Skip to content

Commit cccc62f

Browse files
unibikunibik
unibik
authored andcommitted
Added tests for docker
signed-off-by : Arshad <[email protected]>
1 parent e484e33 commit cccc62f

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

.github/workflows/main.yml

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
name: run tests
2-
1+
name: CI Pipeline
32
on: [push, pull_request]
43

54
env:
@@ -8,6 +7,7 @@ env:
87
DB_PASSWORD: vulnerablecode
98

109
jobs:
10+
# Original test job
1111
build:
1212
runs-on: ubuntu-20.04
1313

@@ -56,3 +56,38 @@ jobs:
5656
VULNERABLECODE_DB_NAME: ${{ env.DB_NAME }}
5757
VULNERABLECODE_DB_USER: ${{ env.DB_USER }}
5858
VULNERABLECODE_DB_PASSWORD: ${{ env.DB_PASSWORD }}
59+
60+
61+
62+
# New job for Docker-based tests
63+
docker-tests:
64+
runs-on: ubuntu-20.04
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v2
69+
70+
- name: Build Docker Image
71+
run: docker compose build --no-cache
72+
73+
- name: Run Tests in Docker Container
74+
run: |
75+
docker compose up -d
76+
docker compose exec vulnerablecode sh -c "
77+
python3 -m venv venv &&
78+
chmod +x venv &&
79+
. venv/bin/activate &&
80+
pip install -r requirements.txt &&
81+
make test && "
82+
env:
83+
GH_TOKEN: 1
84+
POSTGRES_HOST: vulnerablecode-db
85+
POSTGRES_PORT: 5432
86+
VULNERABLECODE_DB_NAME: ${{ env.DB_NAME }}
87+
VULNERABLECODE_DB_USER: ${{ env.DB_USER }}
88+
VULNERABLECODE_DB_PASSWORD: ${{ env.DB_PASSWORD }}
89+
90+
- name: Tear Down Docker Environment
91+
if: always()
92+
run: docker compose down --remove-orphans
93+

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ coreapi==2.3.3
2222
coreschema==0.0.4
2323
cryptography==43.0.1
2424
crispy-bootstrap4==2024.1
25+
cvss
2526
cwe2==3.0.0
2627
dateparser==1.1.1
2728
decorator==5.1.1
@@ -30,6 +31,7 @@ distro==1.7.0
3031
Django==4.2.17
3132
django-crispy-forms==2.3
3233
django-environ==0.11.2
34+
django-extensions==3.2.3
3335
django-filter==24.3
3436
django-widget-tweaks==1.5.0
3537
djangorestframework==3.15.2
@@ -45,6 +47,7 @@ frozenlist==1.3.0
4547
gitdb==4.0.9
4648
GitPython==3.1.41
4749
gunicorn==23.0.0
50+
htmllistparse
4851
idna==3.3
4952
imagesize==1.3.0
5053
importlib-metadata==4.11.3

0 commit comments

Comments
 (0)