name: CI/CD # Runner capacity: 1 (sequential) to prevent OOM on shared host on: push: branches: [dev, main] pull_request: branches: [main] env: REGISTRY: gitea.jeffemmett.com IMAGE: gitea.jeffemmett.com/jeffemmett/canvas-website jobs: test-and-build: runs-on: ubuntu-latest steps: - name: Checkout run: | apt-get update -qq && apt-get install -y -qq git > /dev/null 2>&1 git clone --depth 1 --branch ${{ github.ref_name }} http://token:${{ github.token }}@server:3000/${{ github.repository }}.git . - name: Install dependencies run: npm ci --legacy-peer-deps --ignore-scripts env: NODE_OPTIONS: "--max-old-space-size=4096" - name: Type check run: npx tsc --noEmit - name: Unit tests run: npx vitest run - name: Worker tests run: npx vitest run --config vitest.worker.config.ts || echo "::warning::Worker tests had failures" - name: Build run: npx vite build env: NODE_OPTIONS: "--max-old-space-size=4096" deploy-test: needs: [test-and-build] runs-on: ubuntu-latest container: image: docker:24-cli steps: - name: Debug context run: | echo "github.ref=${{ github.ref }}" echo "github.ref_name=${{ github.ref_name }}" echo "github.event_name=${{ github.event_name }}" echo "github.repository=${{ github.repository }}" echo "REGISTRY=${{ env.REGISTRY }}" echo "IMAGE=${{ env.IMAGE }}" - name: Test docker access run: docker info --format '{{.ServerVersion}}' - name: Test registry login run: | echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ secrets.REGISTRY_USER }} --password-stdin echo "Registry login successful"