MPT-6393 fix renaming issues #115
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: PR build and merge | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
build: | |
services: | |
db: | |
image: postgres:17 | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: mysecurepass | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install uv and set up its cache | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: ".python-version" | |
- name: Install the project dependancies | |
run: uv sync --all-extras --dev | |
- name: Create the .env file | |
run: cp env.example .env | |
- name: Run formatting checks | |
run: uv run ruff format --check --diff . | |
- name: Run linting | |
run: uv run ruff check . | |
- name: Run security checks | |
run: uv run bandit -c pyproject.toml -r . -f json -o bandit.json | |
- name: Run tests | |
run: uv run pytest | |
env: | |
FFC_OPERATIONS_POSTGRES_HOST: localhost | |
FFC_OPERATIONS_POSTGRES_PORT: 5432 | |
- name: SonarQube Scan | |
uses: sonarsource/sonarqube-scan-action@v4 | |
if: ${{ !env.ACT }} | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: SonarQube Quality Gate check | |
id: sonarqube-quality-gate-check | |
uses: sonarsource/sonarqube-quality-gate-action@master | |
if: ${{ !env.ACT }} | |
with: | |
pollingTimeoutSec: 600 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Save code coverage report in the artefacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !env.ACT }} | |
with: | |
name: coverage-report | |
path: htmlcov | |
retention-days: 10 | |
- name: Generate openapi.json | |
run: uv run ffcops openapi -f json -o openapi.json | |
- name: Save openapi.json the artefacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !env.ACT }} | |
with: | |
name: openapi-spec | |
path: openapi.json | |
retention-days: 10 |