# Gitea Actions (GitHub-compatible). Tests on every PR / push. # On push to main, also builds and pushes images to the Gitea registry. # # Requires a registered act_runner labeled ubuntu-latest. Without a runner # Gitea marks the run cancelled. See deploy/unraid/act-runner-compose.yml. # # Repo secret REGISTRY_TOKEN: Gitea token with write:package + write:repository. # Optional var REGISTRY: default 10.37.0.86:3003 (HTTP; mark insecure in Docker). name: CI on: push: branches: [main] pull_request: branches: [main] workflow_dispatch: jobs: test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22 cache: npm cache-dependency-path: | app/package-lock.json app/server/package-lock.json - name: Install frontend working-directory: app run: npm ci - name: Install backend working-directory: app/server run: npm ci - name: Frontend tests working-directory: app run: node --test --experimental-strip-types "src/**/*.test.ts" env: NODE_ENV: development - name: Backend tests working-directory: app/server run: npm test env: NODE_ENV: development - name: Backend typecheck working-directory: app/server run: npm run typecheck images: name: Build and push needs: test if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest env: REGISTRY: ${{ vars.REGISTRY || '10.37.0.86:3003' }} steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: config-inline: | [registry."10.37.0.86:3003"] http = true insecure = true [registry."unraid.local:3003"] http = true insecure = true - name: Log in to Gitea registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.REGISTRY_TOKEN || github.token }} - name: Backend image uses: docker/build-push-action@v6 with: context: ./app/server file: ./app/server/Dockerfile push: true tags: | ${{ env.REGISTRY }}/transnet/investor-flow-backend:${{ github.sha }} ${{ env.REGISTRY }}/transnet/investor-flow-backend:latest cache-from: type=registry,ref=${{ env.REGISTRY }}/transnet/investor-flow-backend:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/transnet/investor-flow-backend:buildcache,mode=max - name: Frontend image uses: docker/build-push-action@v6 with: context: ./app file: ./app/Dockerfile push: true tags: | ${{ env.REGISTRY }}/transnet/investor-flow-frontend:${{ github.sha }} ${{ env.REGISTRY }}/transnet/investor-flow-frontend:latest cache-from: type=registry,ref=${{ env.REGISTRY }}/transnet/investor-flow-frontend:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/transnet/investor-flow-frontend:buildcache,mode=max