85 lines
2.0 KiB
YAML
85 lines
2.0 KiB
YAML
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.x"
|
|
- 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 }}
|