testing modification of CPE #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
architecture: x64 | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install ".[dev]" | |
- name: Display packages version | |
run: | | |
python -c "import sys; print(sys.version)" | |
pip freeze | |
opencve --version | |
- name: Run Black | |
run: black --diff --check {opencve,tests} | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8] | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: opencve | |
POSTGRES_PASSWORD: opencve | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install ".[dev]" | |
- name: Display packages version | |
run: | | |
python -c "import sys; print(sys.version)" | |
pip freeze | |
opencve --version | |
- name: Enable pg_trgm extension | |
run: | | |
PGPASSWORD=opencve psql -h localhost -p 5432 -U opencve opencve -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" | |
- name: Configure database URI | |
run: | | |
pwd | |
ls $GITHUB_WORKSPACE/tests/opencve.cfg | |
sed -i 's$postgresql://user:secret@localhost:5432/dbname$postgresql://opencve:opencve@localhost:5432/opencve$g' $GITHUB_WORKSPACE/tests/opencve.cfg | |
- name: Execute tests | |
run: pytest tests/ -v |