Skip to content

Commit

Permalink
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@ jobs:
unit_tests:
runs-on: ubuntu-latest

services:
# Label used to access the service container
postgres:
image: postgres
env:
POSTGRES_PASSWORD: vulnerablecode
POSTGRES_DB: vulnerablecode
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand All @@ -31,18 +15,36 @@ jobs:
with:
python-version: 3.8

# - name: Restore cache
# uses: actions/cache@v2
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-

- name: Install dependencies
run: |
sudo apt install python3-dev postgresql libpq-dev build-essential libxml2-dev libxslt1-dev
sudo apt install python3-dev postgresql libpq-dev build-essential libxml2-dev libxslt1-dev postgresql ncat
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Setup database
env:
PGPASSWORD: vulnerablecode
run: |
sudo systemctl start postgresql
sudo -Eu postgres psql -c "CREATE ROLE vulnerablecode WITH PASSWORD '$PGPASSWORD' NOSUPERUSER CREATEDB NOCREATEROLE INHERIT LOGIN;"
sudo systemctl status postgresql
createdb --encoding=utf-8 --owner=vulnerablecode --user=vulnerablecode \
--host=localhost --port=5432 vulnerablecode
- name: Run tests
run: python -m pytest -v -m "not webtest"
env:
# The hostname, username used to communicate with the PostgreSQL service container
# The hostname, username used to communicate with Postgresql
POSTGRES_HOST: localhost
VC_DB_USER: postgres
VC_DB_USER: vulnerablecode
POSTGRES_PORT: 5432
DJANGO_DEV: 1
GH_TOKEN: 1

0 comments on commit 9114cb4

Please sign in to comment.