2022-04-25 15:27:10 +02:00
|
|
|
name: API
|
|
|
|
|
|
|
|
on:
|
2023-02-27 12:34:17 +01:00
|
|
|
workflow_dispatch:
|
2022-04-25 15:27:10 +02:00
|
|
|
push:
|
2024-01-13 12:50:51 +01:00
|
|
|
branches: [main, stable-*]
|
2022-04-25 15:27:10 +02:00
|
|
|
paths:
|
2022-09-14 13:45:26 +02:00
|
|
|
- .github/workflows/_python.yml
|
|
|
|
- .github/workflows/api.yml
|
2022-04-25 15:27:10 +02:00
|
|
|
- api/**
|
|
|
|
- shared/**
|
2023-03-14 11:38:43 +01:00
|
|
|
- tools/python*
|
2022-04-25 15:27:10 +02:00
|
|
|
|
|
|
|
pull_request:
|
2024-01-13 12:50:51 +01:00
|
|
|
branches: [main, stable-*]
|
2022-04-25 15:27:10 +02:00
|
|
|
paths:
|
2022-09-14 13:45:26 +02:00
|
|
|
- .github/workflows/_python.yml
|
|
|
|
- .github/workflows/api.yml
|
2022-04-25 15:27:10 +02:00
|
|
|
- api/**
|
|
|
|
- shared/**
|
2023-03-14 11:38:43 +01:00
|
|
|
- tools/python*
|
2022-04-25 15:27:10 +02:00
|
|
|
|
2022-12-07 13:08:13 +01:00
|
|
|
schedule:
|
|
|
|
- cron: 0 1 * * 1
|
|
|
|
|
2022-04-25 15:27:10 +02:00
|
|
|
jobs:
|
|
|
|
python:
|
|
|
|
uses: ./.github/workflows/_python.yml
|
|
|
|
with:
|
|
|
|
context: api
|
|
|
|
test: false
|
|
|
|
|
|
|
|
test-with-database:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
release:
|
|
|
|
- focal
|
2022-09-09 20:45:59 +02:00
|
|
|
- bullseye
|
2022-04-25 15:27:10 +02:00
|
|
|
- jammy
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: libretime
|
|
|
|
POSTGRES_PASSWORD: libretime
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
|
2022-06-18 15:54:16 +02:00
|
|
|
container:
|
|
|
|
image: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
|
2022-08-13 20:24:28 +02:00
|
|
|
options: --user 1001:1001
|
2022-04-25 15:27:10 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
LIBRETIME_DATABASE_HOST: postgres
|
|
|
|
|
|
|
|
steps:
|
2023-10-21 21:30:18 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-04-25 15:27:10 +02:00
|
|
|
|
2024-01-19 18:05:01 +01:00
|
|
|
- uses: actions/cache@v4
|
2022-04-25 15:27:10 +02:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
2022-06-18 15:54:16 +02:00
|
|
|
key: ${{ matrix.release }}-pip-api-${{ hashFiles('api/**/setup.py') }}
|
2022-04-25 15:27:10 +02:00
|
|
|
restore-keys: |
|
2022-06-18 15:54:16 +02:00
|
|
|
${{ matrix.release }}-pip-api
|
2022-04-25 15:27:10 +02:00
|
|
|
|
|
|
|
- name: Test
|
2022-12-07 11:42:16 +01:00
|
|
|
run: make test-coverage
|
2022-04-25 15:27:10 +02:00
|
|
|
working-directory: api
|
2022-06-29 12:18:59 +02:00
|
|
|
|
|
|
|
- name: Report coverage
|
2024-02-05 02:53:43 +01:00
|
|
|
uses: codecov/codecov-action@v4
|
2022-06-29 12:18:59 +02:00
|
|
|
with:
|
|
|
|
files: api/coverage.xml
|
|
|
|
flags: api
|
|
|
|
name: api
|