Marc Cataford
7fa2aff9f9
* ci(frontend): sentinel step * ci(backend): sentinel step * ci(frontend): success to depend on build success
100 lines
2.8 KiB
YAML
100 lines
2.8 KiB
YAML
name: Backend Pipeline
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
task-version:
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
pipeline-success:
|
|
value: ${{ jobs.notify-success.outputs.pipeline_success }}
|
|
|
|
env:
|
|
ROTINI_CI: 1
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
name: Setup
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: get-python-version
|
|
run: |
|
|
echo "python_version=$(cat .python-version)" >> $GITHUB_OUTPUT
|
|
- uses: actions/setup-python@v3
|
|
with:
|
|
python-version: ${{ steps.get-python-version.outputs.python_version }}
|
|
- uses: actions/cache@v3
|
|
id: cache-restore
|
|
with:
|
|
path: |
|
|
backend/.venv
|
|
key: ${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}-${{ steps.get-python-version.outputs.python_version }}
|
|
- name: Install dependencies
|
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
|
run: . script/bootstrap
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
name: Lint
|
|
needs: setup
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: get-python-version
|
|
run: |
|
|
echo "python_version=$(cat .python-version)" >> $GITHUB_OUTPUT
|
|
- uses: actions/setup-python@v3
|
|
with:
|
|
python-version: ${{ steps.get-python-version.outputs.python_version }}
|
|
- name: Setup Task
|
|
uses: arduino/setup-task@v1
|
|
with:
|
|
version: ${{ inputs.task-version }}
|
|
- uses: actions/cache@v3
|
|
id: cache-restore
|
|
with:
|
|
path: |
|
|
backend/.venv
|
|
key: ${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}-${{ steps.get-python-version.outputs.python_version }}
|
|
- name: Lint
|
|
run: |
|
|
task be:lint
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: Test
|
|
needs: setup
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: get-python-version
|
|
run: |
|
|
echo "python_version=$(cat .python-version)" >> $GITHUB_OUTPUT
|
|
- uses: actions/setup-python@v3
|
|
with:
|
|
python-version: ${{ steps.get-python-version.outputs.python_version }}
|
|
- name: Setup Task
|
|
uses: arduino/setup-task@v1
|
|
with:
|
|
version: ${{ inputs.task-version }}
|
|
- uses: actions/cache@v3
|
|
id: cache-restore
|
|
with:
|
|
path: |
|
|
backend/.venv
|
|
key: ${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}-${{ steps.get-python-version.outputs.python_version }}
|
|
- name: Test
|
|
run: |
|
|
task be:test
|
|
notify-success:
|
|
runs-on: ubuntu-latest
|
|
name: Notify success
|
|
needs: [lint, test]
|
|
steps:
|
|
- id: set-output
|
|
working-directory: /
|
|
run: echo "pipeline_success=true" >> "$GITHUB_OUTPUT"
|
|
outputs:
|
|
pipeline_success: ${{ steps.set-output.outputs.pipeline_success }}
|