CUB-207: unit tests for event handlers and initial sync #44

Merged
overseer merged 4 commits from agent/dex/CUB-207-event-sync-tests-v2 into dev 2026-05-20 12:47:28 -04:00
2 changed files with 60 additions and 24 deletions
Showing only changes of commit 20404b30bb - Show all commits

View File

@@ -1,4 +1,4 @@
name: Dev Build
name: Dev Build & Deploy
on:
pull_request:
@@ -6,45 +6,70 @@ on:
push:
branches: [dev]
env:
REGISTRY: code.cubecraftcreations.com
BACKEND_IMAGE: ${{ gitea.repository }}/backend
FRONTEND_IMAGE: ${{ gitea.repository }}/frontend
jobs:
build-test:
runs-on: ubuntu-dotnet
test-and-build:
runs-on: go-react
steps:
- uses: actions/checkout@v4
- name: Restore backend
run: dotnet restore
- name: Run backend tests
run: go test ./...
working-directory: ./go-backend
- name: Build backend
run: dotnet build --no-restore --configuration Release
- name: Test backend
run: dotnet test --no-build --configuration Release
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
run: go build -ldflags="-w -s" -o /tmp/server ./cmd/server
working-directory: ./go-backend
- name: Install frontend deps
run: npm ci
working-directory: ./frontend
- name: Lint frontend
run: npm run lint
working-directory: ./frontend
- name: Build frontend
run: npm run build
working-directory: ./frontend
deploy-dev:
needs: build-test
docker-build-push:
needs: test-and-build
if: gitea.event_name == 'push'
runs-on: ubuntu-latest
runs-on: go-react
steps:
- name: Deploy dev
run: |
echo "${{ secrets.DEV_DEPLOY_SSH_KEY }}" > /tmp/dev_key
chmod 600 /tmp/dev_key
ssh -i /tmp/dev_key -o StrictHostKeyChecking=no \
${{ secrets.DEV_DEPLOY_USER }}@${{ secrets.DEV_DEPLOY_HOST }} \
"${{ secrets.DEV_DEPLOY_PATH }}/deploy.sh"
- uses: actions/checkout@v4
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push backend image
uses: docker/build-push-action@v6
with:
context: ./go-backend
push: true
tags: |
${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:dev
${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ gitea.sha }}
- name: Build & push frontend image
uses: docker/build-push-action@v6
with:
context: ./frontend
push: true
tags: |
${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:dev
${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:${{ gitea.sha }}

11
ci-image/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM catthehacker/ubuntu:act-latest
# Install Go 1.23
RUN curl -sL https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz
# Install Node 22
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/usr/local/go/bin:${PATH}"