Skip to content

Expand meta endpoints. #173

Expand meta endpoints.

Expand meta endpoints. #173

Workflow file for this run

on:
push:
paths-ignore:
- 'ci/**'
- 'README.md'
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
env:
UV_FROZEN: 1
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.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ 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
uv sync --group ci
- name: Test with tox
run: uv run tox -r
env:
MREG_DB_PASSWORD: postgres
- name: Check migrations
run: |
export MREG_DB_NAME=mreg MREG_DB_USER=mreg MREG_DB_PASSWORD=postgres
uv run manage.py makemigrations --check
# - name: Export OpenAPI schema
# run: uv run manage.py generateschema > openapi.yml
# - name: Upload OpenAPI schema
# if: matrix.python-version == '3.10'
# uses: actions/upload-artifact@v4
# with:
# name: openapi.yml
# path: openapi.yml
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: .coverage
if-no-files-found: error
include-hidden-files: true
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.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Download coverage
uses: actions/download-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
- name: Install Coveralls
run: |
uv venv --no-project
uv pip install coveralls
- name: Run Coveralls
run: uv run --no-project 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 }}