Skip to content

Commit 8da4406

Browse files
authored
Merge pull request #687 from nexB/improve-test-run
Improve test run Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2 parents c992168 + bcac526 commit 8da4406

3 files changed

Lines changed: 41 additions & 23 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Documentation
1+
name: generate Documentation
22

33
on: [push, pull_request]
44

.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 }}

.github/workflows/test-import-using-nix.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
on:
22
workflow_dispatch: # allow manual execution
3-
push:
4-
pull_request:
53
schedule:
6-
# run on the 3rd each month at 10:00am
7-
- cron: '0 10 3 * *'
4+
# run daily at 10:00am
5+
- cron: '0 10 * * *'
86

97
jobs:
108
nix-check-and-import:

0 commit comments

Comments
 (0)