Skip to content

Reworking logging in mreg. #257

Reworking logging in mreg.

Reworking logging in mreg. #257

Workflow file for this run

on:
push:
paths-ignore:
- 'ci/**'
- 'README.md'
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
name: CI
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: mreg
POSTGRES_PASSWORD: postgres
# Add health checks to wait until Postgres has started.
options: >-
--health-cmd "pg_isready && PGPASSWORD=$POSTGRES_PASSWORD psql -U mreg -c 'CREATE EXTENSION IF NOT EXISTS citext;' template1 || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Map the containerized port to localhost.
- 5432:5432
strategy:
matrix:
os: [ubuntu-latest]
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: v1-pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements-*.txt') }}
restore-keys: |
v1-pip-${{ runner.os }}-${{ matrix.python-version }}
v1-pip-${{ runner.os }}
v1-pip-
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# Needed to build the native python-ldap extension.
sudo apt-get update
sudo apt-get -y install libsasl2-dev libldap2-dev
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Check migrations
run: python manage.py makemigrations --check
- name: Export OpenAPI schema
run: python manage.py generateschema > openapi.yml
- name: Test
run: coverage run manage.py test -v2
env:
MREG_DB_PASSWORD: postgres
- name: Upload OpenAPI schema
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v3
with:
name: openapi.yml
path: openapi.yml
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.python-version }}
path: .coverage
coveralls:
if: ${{ github.event_name == 'pull_request' || github.repository == 'unioslo/mreg' }}
name: Coveralls
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: v1-pip-${{ runner.os }}-${{ matrix.python-version }}
restore-keys: |
v1-pip-${{ runner.os }}
v1-pip-
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download coverage
uses: actions/download-artifact@v3
with:
name: coverage-${{ matrix.python-version }}
- name: Install Coveralls
run: pip install coveralls
- name: Run Coveralls
run: coveralls
env:
# Note: Set service name to work around
# https://github.com/TheKevJames/coveralls-python/issues/252
COVERALLS_SERVICE_NAME: github
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
finish:
name: Coveralls Completed
needs: coveralls
runs-on: ubuntu-latest
container:
image: thekevjames/coveralls
steps:
- name: Coveralls Finish
run: coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}