Skip to content

Create inspection requirement #230

Create inspection requirement

Create inspection requirement #230

Workflow file for this run

name: Compliance API CI
on:
pull_request:
branches:
- develop
paths:
- "compliance-api/**"
defaults:
run:
shell: bash
working-directory: ./compliance-api
jobs:
setup-job:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: "true"
linting:
needs: setup-job
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('compliance-api/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
sudo apt update
sudo apt install libsasl2-dev libldap2-dev libssl-dev --yes
make setup
- name: Lint with pylint
id: pylint
run: |
make pylint
- name: Lint with flake8
id: flake8
run: |
make flake8
testing:
needs: setup-job
env:
FLASK_ENV: "testing"
JWT_OIDC_TEST_AUDIENCE: "epic-compliance"
JWT_OIDC_TEST_ISSUER: "http://localhost:8081/auth/"
JWT_OIDC_TEST_ALGORITHMS: "RS256"
JWT_OIDC_TEST_WELL_KNOWN_CONFIG: "http://localhost:8081/auth/realms/eao-epic/.well-known/openid-configuration"
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.9]
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('compliance-api/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
make setup
- name: Test
id: test
run: |
make test
- name: Sets Codecov branch name
run: |
echo "CODECOV_BRANCH=PR_${{github.head_ref}}" >> $GITHUB_ENV
if: github.event_name == 'pull_request'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: compliance-api
name: codecov-compliance-api
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
override_branch: ${{ env.CODECOV_BRANCH }}
build:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.9]
name: Build
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build
run: |
docker build . -t reports-api