accounts/.github/workflows/pipeline.yml

114 lines
3.8 KiB
YAML

name: CloudNativeSuite Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: "Target environment"
type: choice
options: [dev, prod]
default: dev
permissions:
contents: read
packages: write
id-token: write
jobs:
code-quality:
name: "Code quality • ${{ matrix.service }} @ ${{ matrix.platform }} (${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }})"
runs-on: ubuntu-latest
env:
ENVIRONMENT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }}
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
service: ["dashboard", "rag-server", "account"]
steps:
- uses: ./.github/actions/code-quality
with:
service: ${{ matrix.service }}
platform: ${{ matrix.platform }}
environment: ${{ env.ENVIRONMENT }}
build:
name: "Build • ${{ matrix.service }} @ ${{ matrix.platform }} (${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }})"
runs-on: ubuntu-latest
needs: code-quality
env:
ENVIRONMENT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }}
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
service: ["dashboard", "rag-server", "account"]
steps:
- uses: ./.github/actions/build
with:
service: ${{ matrix.service }}
platform: ${{ matrix.platform }}
environment: ${{ env.ENVIRONMENT }}
test:
name: "Test • ${{ matrix.service }} @ ${{ matrix.platform }} (${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }})"
runs-on: ubuntu-latest
needs: build
env:
ENVIRONMENT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }}
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
service: ["dashboard", "rag-server", "account"]
steps:
- uses: ./.github/actions/test
with:
service: ${{ matrix.service }}
platform: ${{ matrix.platform }}
environment: ${{ env.ENVIRONMENT }}
security:
name: "Security • ${{ matrix.service }} @ ${{ matrix.platform }} (${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }})"
runs-on: ubuntu-latest
needs: test
env:
ENVIRONMENT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }}
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
service: ["dashboard", "rag-server", "account"]
steps:
- uses: ./.github/actions/security
with:
service: ${{ matrix.service }}
platform: ${{ matrix.platform }}
environment: ${{ env.ENVIRONMENT }}
deploy:
name: "Deploy • ${{ matrix.service }} (${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }})"
runs-on: ubuntu-latest
needs: security
env:
ENVIRONMENT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }}
if: >
github.event_name == 'workflow_dispatch' &&
github.event.inputs.environment == 'prod'
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
service: ["dashboard", "rag-server", "account"]
steps:
- uses: ./.github/actions/deploy
with:
service: ${{ matrix.service }}
platform: ${{ matrix.platform }}
environment: ${{ env.ENVIRONMENT }}