Skip to content

Commit bcac526

Browse files
committed
Run tests on all supported Pythons
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 608f9af commit bcac526

1 file changed

Lines changed: 38 additions & 18 deletions

File tree

.github/workflows/main.yml

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,57 @@
1-
name: CI
2-
on:
3-
push:
4-
branches: [ main ]
1+
name: run tests
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
DB_NAME: vulnerablecode
7+
DB_USER: vulnerablecode
8+
DB_PASSWORD: vulnerablecode
59

6-
pull_request:
7-
types: [opened, synchronize]
810
jobs:
9-
unit_tests:
10-
runs-on: ubuntu-latest
11+
build:
12+
runs-on: ubuntu-20.04
13+
14+
services:
15+
postgres:
16+
image: postgres:latest
17+
env:
18+
POSTGRES_DB: ${{ env.DB_NAME }}
19+
POSTGRES_USER: ${{ env.DB_USER }}
20+
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
21+
options: >-
22+
--health-cmd pg_isready
23+
--health-interval 10s
24+
--health-timeout 5s
25+
--health-retries 5
26+
ports:
27+
- 5432:5432
28+
29+
strategy:
30+
max-parallel: 4
31+
matrix:
32+
python-version: ["3.8", "3.9", "3.10"]
1133

1234
steps:
1335
- name: Checkout code
1436
uses: actions/checkout@v2
1537

16-
- name: Set up Python 3.8.11
38+
- name: Set up Python ${{ matrix.python-version }}
1739
uses: actions/setup-python@v2
1840
with:
19-
python-version: 3.8.11
41+
python-version: ${{ matrix.python-version }}
2042

2143
- name: Install dependencies
22-
run: |
23-
sudo apt-get install -y postgresql python3-dev libpq-dev build-essential
24-
make dev envfile
44+
run: make dev envfile
2545

2646
- name: Validate code format
2747
run: make check
2848

29-
- name: Setup database
30-
run: |
31-
sudo systemctl start postgresql
32-
make postgres
33-
3449
- name: Run tests
3550
run: make test
3651
env:
3752
GH_TOKEN: 1
53+
POSTGRES_HOST: localhost
54+
POSTGRES_PORT: 5432
55+
VULNERABLECODE_DB_NAME: ${{ env.DB_NAME }}
56+
VULNERABLECODE_DB_USER: ${{ env.DB_USER }}
57+
VULNERABLECODE_DB_PASSWORD: ${{ env.DB_PASSWORD }}

0 commit comments

Comments
 (0)