ci: reduce usage (#1804)
* ci: move analyzer jobs in a dedicated workflow * ci: move worker jobs in a dedicated workflow * ci: move legacy jobs in a dedicated workflow * ci: move shared jobs in a dedicated workflow * ci: move api-client jobs to dedicated workflow * ci: remove unused test job * ci: move api jobs in a dedicated workflow * ci: move playout ci jobs in a dedicated workflow * ci: remove unused test job * ci: move test-with-database in api workflow * ci: run playout on api-client changes * ci: rename tools workflow to dev-tools * ci: rename generic tests workflow to project * ci: rename lint-pr workflow to pr * ci: update python tests concurrency * ci: update python caching keys * ci: update website/docs trigger condition * ci: update legacy trigger condition * ci: readd cancel in progress * ci :update api cache key
This commit is contained in:
parent
7a15a61d01
commit
e320ce204e
|
@ -0,0 +1,75 @@
|
|||
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@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: actions/cache@v3
|
||||
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:
|
||||
- buster
|
||||
- bullseye
|
||||
- bionic
|
||||
- focal
|
||||
- jammy
|
||||
|
||||
container: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/cache@v3
|
||||
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: Test
|
||||
run: make test
|
||||
working-directory: ${{ inputs.context }}
|
|
@ -0,0 +1,22 @@
|
|||
name: Analyzer
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- analyzer/**
|
||||
- shared/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- analyzer/**
|
||||
- shared/**
|
||||
|
||||
jobs:
|
||||
python:
|
||||
uses: ./.github/workflows/_python.yml
|
||||
with:
|
||||
context: analyzer
|
|
@ -0,0 +1,22 @@
|
|||
name: API Client
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- api-client/**
|
||||
- shared/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- api-client/**
|
||||
- shared/**
|
||||
|
||||
jobs:
|
||||
python:
|
||||
uses: ./.github/workflows/_python.yml
|
||||
with:
|
||||
context: api-client
|
|
@ -0,0 +1,68 @@
|
|||
name: API
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- api/**
|
||||
- shared/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- api/**
|
||||
- shared/**
|
||||
|
||||
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:
|
||||
- buster
|
||||
- bullseye
|
||||
- bionic
|
||||
- focal
|
||||
- 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
|
||||
|
||||
container: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
env:
|
||||
LIBRETIME_DATABASE_HOST: postgres
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-api-${{ hashFiles('api/**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-api
|
||||
|
||||
- name: Test
|
||||
run: make test
|
||||
working-directory: api
|
|
@ -1,4 +1,4 @@
|
|||
name: Tools
|
||||
name: Dev Tools
|
||||
|
||||
on:
|
||||
schedule:
|
||||
|
@ -6,8 +6,8 @@ on:
|
|||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- ".github/workflows/dev-tools.yml"
|
||||
- "**/packages.ini"
|
||||
- ".github/workflows/tools.yml"
|
||||
|
||||
jobs:
|
||||
docker-dev-image:
|
|
@ -5,10 +5,15 @@ on:
|
|||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/docs.yml
|
||||
- website/**
|
||||
- docs/**
|
||||
- website/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/docs.yml
|
||||
- docs/**
|
||||
- website/**
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
name: Legacy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- api/**
|
||||
- legacy/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- api/**
|
||||
- legacy/**
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
- name: Lint
|
||||
run: make lint
|
||||
working-directory: legacy
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- php-version: "7.2" # Bionic
|
||||
- php-version: "7.3" # Buster
|
||||
- php-version: "7.4" # Bullseye, Focal
|
||||
|
||||
env:
|
||||
ENVIRONMENT: testing
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PostgreSQL
|
||||
run: |
|
||||
sudo systemctl start postgresql.service
|
||||
pg_isready
|
||||
sudo -u postgres psql -c 'CREATE DATABASE libretime;'
|
||||
sudo -u postgres psql -c "CREATE USER libretime WITH PASSWORD 'libretime';"
|
||||
sudo -u postgres psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;'
|
||||
sudo -u postgres psql -c 'ALTER USER libretime CREATEDB;'
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Run tests
|
||||
run: make test
|
||||
working-directory: legacy
|
|
@ -0,0 +1,25 @@
|
|||
name: Playout
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- playout/**
|
||||
- api-client/**
|
||||
- shared/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- playout/**
|
||||
- api-client/**
|
||||
- shared/**
|
||||
|
||||
jobs:
|
||||
python:
|
||||
uses: ./.github/workflows/_python.yml
|
||||
with:
|
||||
context: playout
|
||||
test: false
|
|
@ -1,4 +1,4 @@
|
|||
name: Lint PR
|
||||
name: PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
|
@ -0,0 +1,48 @@
|
|||
name: Project
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, edited]
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v2.0.3
|
||||
|
||||
check-shell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- run: |
|
||||
python -m venv venv && source venv/bin/activate
|
||||
pip install gh-release-install
|
||||
|
||||
sudo venv/bin/gh-release-install \
|
||||
koalaman/shellcheck \
|
||||
shellcheck-{tag}.linux.x86_64.tar.xz --extract shellcheck-{tag}/shellcheck \
|
||||
/usr/bin/shellcheck
|
||||
|
||||
sudo venv/bin/gh-release-install \
|
||||
mvdan/sh \
|
||||
shfmt_{tag}_linux_amd64 \
|
||||
/usr/bin/shfmt
|
||||
|
||||
- run: SEVERITY=warning make shell-check
|
||||
|
||||
test-tools:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- run: make all
|
||||
working-directory: tools
|
|
@ -0,0 +1,20 @@
|
|||
name: Shared
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- shared/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- shared/**
|
||||
|
||||
jobs:
|
||||
python:
|
||||
uses: ./.github/workflows/_python.yml
|
||||
with:
|
||||
context: shared
|
|
@ -1,220 +0,0 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, edited]
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v2.0.3
|
||||
|
||||
check-shell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- run: |
|
||||
python -m venv venv && source venv/bin/activate
|
||||
pip install gh-release-install
|
||||
|
||||
sudo venv/bin/gh-release-install \
|
||||
koalaman/shellcheck \
|
||||
shellcheck-{tag}.linux.x86_64.tar.xz --extract shellcheck-{tag}/shellcheck \
|
||||
/usr/bin/shellcheck
|
||||
|
||||
sudo venv/bin/gh-release-install \
|
||||
mvdan/sh \
|
||||
shfmt_{tag}_linux_amd64 \
|
||||
/usr/bin/shfmt
|
||||
|
||||
- run: SEVERITY=warning make shell-check
|
||||
|
||||
test-tools:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- run: make all
|
||||
working-directory: tools
|
||||
|
||||
lint-legacy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
- name: Lint
|
||||
run: make lint
|
||||
working-directory: legacy
|
||||
|
||||
test-legacy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- php-version: "7.2" # Bionic
|
||||
- php-version: "7.3" # Buster
|
||||
- php-version: "7.4" # Bullseye, Focal
|
||||
|
||||
env:
|
||||
ENVIRONMENT: testing
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PostgreSQL
|
||||
run: |
|
||||
sudo systemctl start postgresql.service
|
||||
pg_isready
|
||||
sudo -u postgres psql -c 'CREATE DATABASE libretime;'
|
||||
sudo -u postgres psql -c "CREATE USER libretime WITH PASSWORD 'libretime';"
|
||||
sudo -u postgres psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;'
|
||||
sudo -u postgres psql -c 'ALTER USER libretime CREATEDB;'
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-composer-
|
||||
|
||||
- name: Run tests
|
||||
run: make test
|
||||
working-directory: legacy
|
||||
|
||||
# Start lint the code without failing the entire workflow, should be merged
|
||||
# into 'test' when the entire matrix succeeds.
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
context:
|
||||
- analyzer
|
||||
- api
|
||||
- api-client
|
||||
- playout
|
||||
- shared
|
||||
- worker
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Add annotations matchers
|
||||
run: |
|
||||
echo "::add-matcher::.github/annotations/pylint.json"
|
||||
|
||||
- name: Lint
|
||||
run: make lint
|
||||
working-directory: ${{ matrix.context }}
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
context:
|
||||
- analyzer
|
||||
- api-client
|
||||
- shared
|
||||
release:
|
||||
- buster
|
||||
- bullseye
|
||||
- bionic
|
||||
- focal
|
||||
- jammy
|
||||
|
||||
container: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ matrix.context }}-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-${{ matrix.context }}
|
||||
|
||||
- name: Test
|
||||
run: make test
|
||||
working-directory: ${{ matrix.context }}
|
||||
|
||||
test-with-database:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
context:
|
||||
- api
|
||||
release:
|
||||
- buster
|
||||
- bullseye
|
||||
- bionic
|
||||
- focal
|
||||
- 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
|
||||
|
||||
container: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
env:
|
||||
LIBRETIME_DATABASE_HOST: postgres
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ matrix.context }}-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-${{ matrix.context }}
|
||||
|
||||
- name: Test
|
||||
run: make test
|
||||
working-directory: ${{ matrix.context }}
|
|
@ -5,15 +5,15 @@ on:
|
|||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/website.yml
|
||||
- website/**
|
||||
- docs/**
|
||||
- website/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/website.yml
|
||||
- website/**
|
||||
- docs/**
|
||||
- website/**
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
name: Worker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- worker/**
|
||||
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/**
|
||||
- worker/**
|
||||
|
||||
jobs:
|
||||
python:
|
||||
uses: ./.github/workflows/_python.yml
|
||||
with:
|
||||
context: worker
|
||||
test: false
|
Loading…
Reference in New Issue