mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 20:44:02 +00:00
141 lines
3.0 KiB
YAML
141 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
quality:
|
|
name: Quality / ${{ matrix.task }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
task:
|
|
- format
|
|
- lint
|
|
- typecheck
|
|
- test
|
|
- build
|
|
- db-check
|
|
- db-migrations
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: .bun-version
|
|
|
|
- name: Restore Bun cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Run quality gate
|
|
run: |
|
|
case "${{ matrix.task }}" in
|
|
format)
|
|
bun run format:check
|
|
;;
|
|
lint)
|
|
bun run lint
|
|
;;
|
|
typecheck)
|
|
bun run typecheck
|
|
;;
|
|
test)
|
|
bun run test
|
|
;;
|
|
build)
|
|
bun run build
|
|
;;
|
|
db-check)
|
|
bun run db:check
|
|
;;
|
|
db-migrations)
|
|
bun run db:migrations:check
|
|
;;
|
|
*)
|
|
echo "Unknown task: ${{ matrix.task }}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
terraform:
|
|
name: Terraform / validate
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Terraform
|
|
uses: hashicorp/setup-terraform@v3
|
|
with:
|
|
terraform_version: 1.8.5
|
|
|
|
- name: Terraform format check
|
|
run: terraform -chdir=infra/terraform fmt -check -recursive
|
|
|
|
- name: Terraform validate
|
|
run: |
|
|
terraform -chdir=infra/terraform init -backend=false
|
|
terraform -chdir=infra/terraform validate
|
|
|
|
images:
|
|
name: Docker / build ${{ matrix.service }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
service:
|
|
- bot
|
|
- miniapp
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build container image
|
|
run: |
|
|
case "${{ matrix.service }}" in
|
|
bot)
|
|
docker build -f apps/bot/Dockerfile -t household-bot:ci .
|
|
;;
|
|
miniapp)
|
|
docker build -f apps/miniapp/Dockerfile -t household-miniapp:ci .
|
|
;;
|
|
*)
|
|
echo "Unknown service: ${{ matrix.service }}"
|
|
exit 1
|
|
;;
|
|
esac
|