2023-08-11 05:31:38 +00:00
|
|
|
name: Backend Pipeline
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2023-08-12 16:33:12 +00:00
|
|
|
inputs:
|
|
|
|
task-version:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-08-12 21:20:22 +00:00
|
|
|
outputs:
|
|
|
|
pipeline-success:
|
|
|
|
value: ${{ jobs.notify-success.outputs.pipeline_success }}
|
2023-08-12 15:45:51 +00:00
|
|
|
|
2023-08-12 19:56:52 +00:00
|
|
|
env:
|
|
|
|
ROTINI_CI: 1
|
|
|
|
|
2023-08-12 20:32:07 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: backend
|
|
|
|
|
2023-08-11 05:31:38 +00:00
|
|
|
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: |
|
2023-08-12 15:59:03 +00:00
|
|
|
backend/.venv
|
2023-08-11 05:31:38 +00:00
|
|
|
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 }}
|
2023-08-12 15:45:51 +00:00
|
|
|
- name: Setup Task
|
|
|
|
uses: arduino/setup-task@v1
|
|
|
|
with:
|
2023-08-12 16:33:12 +00:00
|
|
|
version: ${{ inputs.task-version }}
|
2023-08-11 05:31:38 +00:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
id: cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
2023-08-12 15:59:03 +00:00
|
|
|
backend/.venv
|
2023-08-11 05:31:38 +00:00
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}-${{ steps.get-python-version.outputs.python_version }}
|
|
|
|
- name: Lint
|
|
|
|
run: |
|
2023-08-12 15:45:51 +00:00
|
|
|
task be:lint
|
2023-08-11 17:58:22 +00:00
|
|
|
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 }}
|
2023-08-12 15:45:51 +00:00
|
|
|
- name: Setup Task
|
|
|
|
uses: arduino/setup-task@v1
|
|
|
|
with:
|
2023-08-12 16:33:12 +00:00
|
|
|
version: ${{ inputs.task-version }}
|
2023-08-11 17:58:22 +00:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
id: cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
2023-08-12 15:59:03 +00:00
|
|
|
backend/.venv
|
2023-08-11 17:58:22 +00:00
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}-${{ steps.get-python-version.outputs.python_version }}
|
2023-08-12 15:45:51 +00:00
|
|
|
- name: Test
|
2023-08-11 17:58:22 +00:00
|
|
|
run: |
|
2023-08-12 15:45:51 +00:00
|
|
|
task be:test
|
2023-08-16 03:57:09 +00:00
|
|
|
docker-build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Build Development Docker Image
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Task
|
|
|
|
uses: arduino/setup-task@v1
|
|
|
|
with:
|
|
|
|
version: ${{ inputs.task-version }}
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
task be:docker-build
|
2023-08-12 21:20:22 +00:00
|
|
|
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 }}
|