Skip to content

Commit ebb6e66

Browse files
authored
Merge pull request #295 from sbs2001/gh_action
Use GH action instead travis for CI.
2 parents d886469 + 6d9a4c8 commit ebb6e66

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
jobs:
6+
unit_tests:
7+
runs-on: ubuntu-latest
8+
9+
services:
10+
# Label used to access the service container
11+
postgres:
12+
image: postgres
13+
env:
14+
POSTGRES_PASSWORD: vulnerablecode
15+
POSTGRES_DB: vulnerablecode
16+
# Set health checks to wait until postgres has started
17+
options: >-
18+
--health-cmd pg_isready
19+
--health-interval 10s
20+
--health-timeout 5s
21+
--health-retries 5
22+
ports:
23+
# Maps tcp port 5432 on service container to the host
24+
- 5432:5432
25+
steps:
26+
- name: Check out repository code
27+
uses: actions/checkout@v2
28+
29+
- name: Set up Python 3.8
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: 3.8
33+
34+
- name: Install dependencies
35+
run: |
36+
sudo apt install python3-dev postgresql libpq-dev build-essential libxml2-dev libxslt1-dev
37+
python -m pip install --upgrade pip
38+
pip install -r requirements.txt
39+
40+
- name: Run tests
41+
run: pytest
42+
env:
43+
# The hostname, username used to communicate with the PostgreSQL service container
44+
POSTGRES_HOST: localhost
45+
VC_DB_USER: postgres
46+
POSTGRES_PORT: 5432
47+
DJANGO_DEV: 1
48+
GH_TOKEN: 1

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ notifications:
2828
- https://webhooks.gitter.im/e/b119fa557626081e1f36
2929
on_success: change # options: [always|never|change] default: always
3030
on_failure: always # options: [always|never|change] default: always
31-
on_start: never # options: [always|never|change] default: always
31+
on_start: never # options: [always|never|change] default: always

0 commit comments

Comments
 (0)