Files
homelab/.gitea/workflows/ci.yaml
Julia McGhee 22488d5bf5
Some checks failed
CI / changes (push) Successful in 5s
CI / lint-and-test (push) Successful in 41s
Deploy Production / deploy (push) Failing after 5s
CI / build (push) Has been skipped
Fix CI: install jq/kustomize, fetch-depth 2 for deploy-production
node:20-bookworm doesn't include jq or kustomize. Also need
fetch-depth: 2 so HEAD~1 exists for turbo's change detection.
2026-03-21 16:34:22 +00:00

80 lines
2.2 KiB
YAML

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ gitea.workflow }}-${{ gitea.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
outputs:
apps: ${{ steps.filter.outputs.apps }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: apt-get update && apt-get install -y jq
- name: Detect changed apps
id: filter
run: |
if [ "${{ gitea.event_name }}" = "pull_request" ]; then
CHANGED=$(git diff --name-only origin/main...HEAD)
else
CHANGED=$(git diff --name-only HEAD~1)
fi
APPS="[]"
for app in web api harness; do
if echo "$CHANGED" | grep -qE "^(apps/${app}/|packages/)"; then
APPS=$(echo "$APPS" | jq -c ". + [\"${app}\"]")
fi
done
echo "apps=$APPS" >> "$GITHUB_OUTPUT"
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable && corepack prepare pnpm@latest --activate
- run: pnpm install --frozen-lockfile
- run: pnpm turbo lint test
build:
needs: [changes, lint-and-test]
runs-on: ubuntu-latest
if: needs.changes.outputs.apps != '[]'
strategy:
matrix:
app: ${{ fromJson(needs.changes.outputs.apps) }}
steps:
- uses: actions/checkout@v4
- run: corepack enable && corepack prepare pnpm@latest --activate
- run: pnpm install --frozen-lockfile
- run: pnpm turbo build --filter=@homelab/${{ matrix.app }}
- name: Build Docker image
run: |
docker build \
-t gitea.coreworlds.io/lazorgurl/homelab-${{ matrix.app }}:${{ gitea.sha }} \
-t gitea.coreworlds.io/lazorgurl/homelab-${{ matrix.app }}:pr-${{ gitea.event.number }} \
apps/${{ matrix.app }}
- name: Push to registry
if: gitea.event_name == 'push' || gitea.event_name == 'pull_request'
run: |
echo "${{ gitea.token }}" | docker login gitea.coreworlds.io -u ${{ gitea.actor }} --password-stdin
docker push gitea.coreworlds.io/lazorgurl/homelab-${{ matrix.app }}:${{ gitea.sha }}