From 5356229312ffb7caec30920d0ae8076ead13c00d Mon Sep 17 00:00:00 2001 From: Otto the Minion Date: Wed, 20 May 2026 12:33:33 -0400 Subject: [PATCH] CUB-125: Sync dev.yml with dev branch (consolidated Go/React workflow) --- .gitea/workflows/dev.yml | 83 ++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/dev.yml b/.gitea/workflows/dev.yml index 5daf743..7ddd342 100644 --- a/.gitea/workflows/dev.yml +++ b/.gitea/workflows/dev.yml @@ -1,4 +1,4 @@ -name: Dev Build +name: Dev Build & Deploy on: pull_request: @@ -6,39 +6,82 @@ on: push: branches: [dev] +env: + GO_VERSION: "1.23" + NODE_VERSION: "22" + REGISTRY: code.cubecraftcreations.com + BACKEND_IMAGE: ${{ gitea.repository }}/backend + FRONTEND_IMAGE: ${{ gitea.repository }}/frontend + jobs: - build-test: + test-and-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - name: Install Go + run: | + curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | sudo tar -C /usr/local -xz + echo "/usr/local/go/bin" >> $GITHUB_PATH - - name: Restore backend - run: dotnet restore - working-directory: ./backend + - name: Install Node.js + run: | + curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" | sudo tar -C /usr/local --strip-components=1 -xJ + echo "/usr/local/bin" >> $GITHUB_PATH + + - name: Run backend tests + run: go test ./... + working-directory: ./go-backend - name: Build backend - run: dotnet build --no-restore --configuration Release - working-directory: ./backend - - - name: Test backend - run: dotnet test --no-build --configuration Release - working-directory: ./backend - - - 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 + + docker-build-push: + needs: test-and-build + if: gitea.event_name == 'push' + runs-on: ubuntu-latest + + steps: + - 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 }}