157 lines
4.5 KiB
YAML
157 lines
4.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: [ubuntu-latest]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install Frontend Dependencies
|
|
run: cd frontend && npm ci
|
|
|
|
- name: Lint Frontend
|
|
run: cd frontend && npm run lint || echo "Linting not configured yet"
|
|
|
|
- name: Build Frontend
|
|
run: cd frontend && npm run build
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.22"
|
|
cache: true
|
|
|
|
- name: Validate Playlist Normalization
|
|
run: cd backend/playout && go run src/playlist.go playlist.txt || echo "Validation script not yet complete"
|
|
|
|
- name: Build Docker Images
|
|
run: docker compose build --no-cache
|
|
|
|
- name: Run Tests
|
|
run: echo "Tests will be added in future CI steps (per TODO.md)"
|
|
|
|
docker:
|
|
needs: test
|
|
runs-on: [ubuntu-latest]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.allucanget.biz
|
|
username: ${{ secrets.CI_REGISTRY_USER }}
|
|
password: ${{ secrets.CI_REGISTRY_TOKEN }}
|
|
|
|
- name: Extract metadata for Playout
|
|
id: meta-playout
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.allucanget.biz/zwitschi/linearvoid/playout
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push Playout image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./backend/playout
|
|
file: ./backend/playout/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta-playout.outputs.tags }}
|
|
labels: ${{ steps.meta-playout.outputs.labels }}
|
|
|
|
- name: Extract metadata for Chat
|
|
id: meta-chat
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.allucanget.biz/zwitschi/linearvoid/chat
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push Chat image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./backend/chat
|
|
push: true
|
|
tags: ${{ steps.meta-chat.outputs.tags }}
|
|
labels: ${{ steps.meta-chat.outputs.labels }}
|
|
|
|
- name: Extract metadata for Nginx
|
|
id: meta-nginx
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.allucanget.biz/zwitschi/linearvoid/nginx
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push Nginx image
|
|
run: |
|
|
TAGS="${{ steps.meta-nginx.outputs.tags }}"
|
|
LABELS="${{ steps.meta-nginx.outputs.labels }}"
|
|
TAG_ARGS=""
|
|
for tag in $TAGS; do
|
|
TAG_ARGS="$TAG_ARGS --tag $tag"
|
|
done
|
|
LABEL_ARGS=""
|
|
while IFS= read -r label; do
|
|
[ -n "$label" ] && LABEL_ARGS="$LABEL_ARGS --label $label"
|
|
done <<< "$LABELS"
|
|
docker buildx build \
|
|
--push \
|
|
--file infrastructure/nginx/Dockerfile \
|
|
$TAG_ARGS \
|
|
$LABEL_ARGS \
|
|
.
|
|
|
|
release:
|
|
needs: docker
|
|
runs-on: [ubuntu-latest]
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.CI_REGISTRY_TOKEN }}
|