Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
relative_files=True

[paths]
source=src
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install Python dependencies, run pre-commit checks, and run tests with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI verify

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
check-title:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check title name convention
uses: jef/conventional-commits-pr-action@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
code-check:
uses: ./.github/workflows/code-check.yml
unit-tests:
uses: ./.github/workflows/unit-tests.yml
security-scan:
needs: [unit-tests]
uses: ./.github/workflows/security-scan.yml
secrets:
FOSSA_TOKEN: ${{ secrets.FOSSA_TOKEN }}
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Python code checks

on:
workflow_call:
push:
branches: [ main ]

jobs:
check-code:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"

- name: Run pre-commit checks
uses: pre-commit/action@v2.0.3
with:
extra_args: --all-files
49 changes: 0 additions & 49 deletions .github/workflows/python-app.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Firebolt Security Scan

on:
workflow_dispatch:
pull_request:
push:
branches: [ master ]
workflow_call:
secrets:
FOSSA_TOKEN:
required: true
SONARCLOUD_TOKEN:
required: true

jobs:
security-scan:
Expand All @@ -13,6 +15,11 @@ jobs:
- name: "Checkout Code"
uses: actions/checkout@v2

- name: "Download coverage report"
uses: actions/download-artifact@v2
with:
name: pytest-coverage-report

- name: "Security Scan"
uses: firebolt-db/action-security-scan@main
with:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Unit tests

on:
workflow_call:
push:
branches: [ main ]

jobs:
unit-tests:

runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run unit tests
run: |
pytest --cov=src/ tests/unit --cov-report=xml

- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: pytest-coverage-report
path: coverage.xml
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,14 @@ repos:
additional_dependencies:
- flake8-tidy-imports
- flake8-quotes

- repo: local
hooks:
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
require_serial: true
verbose: true
pass_filenames: false
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ dev =
mypy==0.910
pre-commit==2.15.0
pytest==6.2.5
pytest-asyncio==0.16.0
pytest-cov==3.0.0
sqlalchemy-stubs==0.4

[mypy]
disallow_untyped_defs = True
show_error_codes = True
plugins = sqlmypy
files = src/

[pydantic-mypy]
warn_required_dynamic_aliases = True
Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ sonar.projectKey=firebolt-db_firebolt-sqlalchemy
sonar.organization=firebolt-db
sonar.sources=src
sonar.python.version=3
sonar.python.coverage.reportPaths=coverage.xml