ci: fine grained test release (#3171)

### Description

Allow fine grained configuration on which release the test should be
run. This will be useful to start testing liquidsoap >=2.0.0 in our ci.
This commit is contained in:
Jonas L. 2025-06-14 18:41:59 +02:00 committed by GitHub
parent 63ff50b82c
commit 23917f7d8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 194 additions and 109 deletions

34
.github/workflows/_python-lint.yml vendored Normal file
View File

@ -0,0 +1,34 @@
on:
workflow_call:
inputs:
context:
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-lint
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ inputs.context }}-${{ hashFiles(format('{0}/{1}', inputs.context, '**/setup.py')) }}
restore-keys: |
${{ runner.os }}-pip-${{ inputs.context }}
- name: Add annotations matchers
run: |
echo "::add-matcher::.github/annotations/pylint.json"
- name: Lint
run: make lint
working-directory: ${{ inputs.context }}

46
.github/workflows/_python-test.yml vendored Normal file
View File

@ -0,0 +1,46 @@
on:
workflow_call:
inputs:
context:
required: true
type: string
release:
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-test-${{ inputs.release }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/libretime/libretime-dev:${{ inputs.release }}
options: --user 1001:1001
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ inputs.release }}-pip-${{ inputs.context }}-${{ hashFiles(format('{0}/{1}', inputs.context, '**/setup.py')) }}
restore-keys: |
${{ inputs.release }}-pip-${{ inputs.context }}
- name: Test
run: make test-coverage
working-directory: ${{ inputs.context }}
- name: Report coverage
uses: codecov/codecov-action@v5
with:
files: ${{ inputs.context }}/coverage.xml
flags: ${{ inputs.context }}
name: ${{ inputs.context }}

View File

@ -1,84 +0,0 @@
on:
workflow_call:
inputs:
context:
required: true
type: string
lint:
required: false
default: true
type: boolean
test:
required: false
default: true
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
if: inputs.lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ inputs.context }}-${{ hashFiles(format('{0}/{1}', inputs.context, '**/setup.py')) }}
restore-keys: |
${{ runner.os }}-pip-${{ inputs.context }}
- name: Add annotations matchers
run: |
echo "::add-matcher::.github/annotations/pylint.json"
- name: Lint
run: make lint
working-directory: ${{ inputs.context }}
test:
if: inputs.test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
release:
- focal
- bullseye
- jammy
container:
image: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
options: --user 1001:1001
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ matrix.release }}-pip-${{ inputs.context }}-${{ hashFiles(format('{0}/{1}', inputs.context, '**/setup.py')) }}
restore-keys: |
${{ matrix.release }}-pip-${{ inputs.context }}
- name: Test
run: make test-coverage
working-directory: ${{ inputs.context }}
- name: Report coverage
uses: codecov/codecov-action@v5
with:
files: ${{ inputs.context }}/coverage.xml
flags: ${{ inputs.context }}
name: ${{ inputs.context }}

View File

@ -5,7 +5,7 @@ on:
push: push:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/analyzer.yml - .github/workflows/analyzer.yml
- analyzer/** - analyzer/**
- shared/** - shared/**
@ -14,7 +14,7 @@ on:
pull_request: pull_request:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/analyzer.yml - .github/workflows/analyzer.yml
- analyzer/** - analyzer/**
- shared/** - shared/**
@ -24,7 +24,25 @@ on:
- cron: 0 1 * * 1 - cron: 0 1 * * 1
jobs: jobs:
python: lint:
uses: ./.github/workflows/_python.yml uses: ./.github/workflows/_python-lint.yml
with: with:
context: analyzer context: analyzer
test-focal:
uses: ./.github/workflows/_python-test.yml
with:
context: analyzer
release: focal
test-bullseye:
uses: ./.github/workflows/_python-test.yml
with:
context: analyzer
release: bullseye
test-jammy:
uses: ./.github/workflows/_python-test.yml
with:
context: analyzer
release: jammy

View File

@ -5,7 +5,7 @@ on:
push: push:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/api-client.yml - .github/workflows/api-client.yml
- api-client/** - api-client/**
- shared/** - shared/**
@ -14,7 +14,7 @@ on:
pull_request: pull_request:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/api-client.yml - .github/workflows/api-client.yml
- api-client/** - api-client/**
- shared/** - shared/**
@ -24,7 +24,25 @@ on:
- cron: 0 1 * * 1 - cron: 0 1 * * 1
jobs: jobs:
python: lint:
uses: ./.github/workflows/_python.yml uses: ./.github/workflows/_python-lint.yml
with: with:
context: api-client context: api-client
test-focal:
uses: ./.github/workflows/_python-test.yml
with:
context: api-client
release: focal
test-bullseye:
uses: ./.github/workflows/_python-test.yml
with:
context: api-client
release: bullseye
test-jammy:
uses: ./.github/workflows/_python-test.yml
with:
context: api-client
release: jammy

View File

@ -5,7 +5,7 @@ on:
push: push:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/api.yml - .github/workflows/api.yml
- api/** - api/**
- shared/** - shared/**
@ -14,7 +14,7 @@ on:
pull_request: pull_request:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/api.yml - .github/workflows/api.yml
- api/** - api/**
- shared/** - shared/**
@ -24,11 +24,10 @@ on:
- cron: 0 1 * * 1 - cron: 0 1 * * 1
jobs: jobs:
python: lint:
uses: ./.github/workflows/_python.yml uses: ./.github/workflows/_python-lint.yml
with: with:
context: api context: api
test: false
test-with-database: test-with-database:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -5,7 +5,7 @@ on:
push: push:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/playout.yml - .github/workflows/playout.yml
- playout/** - playout/**
- api-client/** - api-client/**
@ -15,7 +15,7 @@ on:
pull_request: pull_request:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/playout.yml - .github/workflows/playout.yml
- playout/** - playout/**
- api-client/** - api-client/**
@ -26,7 +26,25 @@ on:
- cron: 0 1 * * 1 - cron: 0 1 * * 1
jobs: jobs:
python: lint:
uses: ./.github/workflows/_python.yml uses: ./.github/workflows/_python-lint.yml
with: with:
context: playout context: playout
test-focal:
uses: ./.github/workflows/_python-test.yml
with:
context: playout
release: focal
test-bullseye:
uses: ./.github/workflows/_python-test.yml
with:
context: playout
release: bullseye
test-jammy:
uses: ./.github/workflows/_python-test.yml
with:
context: playout
release: jammy

View File

@ -5,7 +5,7 @@ on:
push: push:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/shared.yml - .github/workflows/shared.yml
- shared/** - shared/**
- tools/python* - tools/python*
@ -13,7 +13,7 @@ on:
pull_request: pull_request:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/shared.yml - .github/workflows/shared.yml
- shared/** - shared/**
- tools/python* - tools/python*
@ -22,7 +22,25 @@ on:
- cron: 0 1 * * 1 - cron: 0 1 * * 1
jobs: jobs:
python: lint:
uses: ./.github/workflows/_python.yml uses: ./.github/workflows/_python-lint.yml
with: with:
context: shared context: shared
test-focal:
uses: ./.github/workflows/_python-test.yml
with:
context: shared
release: focal
test-bullseye:
uses: ./.github/workflows/_python-test.yml
with:
context: shared
release: bullseye
test-jammy:
uses: ./.github/workflows/_python-test.yml
with:
context: shared
release: jammy

View File

@ -5,7 +5,7 @@ on:
push: push:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/worker.yml - .github/workflows/worker.yml
- worker/** - worker/**
- tools/python* - tools/python*
@ -13,7 +13,7 @@ on:
pull_request: pull_request:
branches: [main, stable-*] branches: [main, stable-*]
paths: paths:
- .github/workflows/_python.yml - .github/workflows/_python-*.yml
- .github/workflows/worker.yml - .github/workflows/worker.yml
- worker/** - worker/**
- tools/python* - tools/python*
@ -22,7 +22,25 @@ on:
- cron: 0 1 * * 1 - cron: 0 1 * * 1
jobs: jobs:
python: lint:
uses: ./.github/workflows/_python.yml uses: ./.github/workflows/_python-lint.yml
with: with:
context: worker context: worker
test-focal:
uses: ./.github/workflows/_python-test.yml
with:
context: worker
release: focal
test-bullseye:
uses: ./.github/workflows/_python-test.yml
with:
context: worker
release: bullseye
test-jammy:
uses: ./.github/workflows/_python-test.yml
with:
context: worker
release: jammy