refactor: revert CI image approach and use standard npm ci in workflows
The CI image approach with pre-installed dependencies doesn't work with Gitea Actions due to workspace mounting issues. When Gitea Actions runs a container job, it mounts the workspace at a specific path (e.g., /workspace/david/euchre_camp), which hides the container's /app directory where dependencies were installed. Changes: - Reverted pr.yml unit-tests to use node:20-alpine with npm ci - Updated pr.yml acceptance-tests to use mcr.microsoft.com/playwright image with npm ci - Updated test.yml to use node:20-alpine with npm ci - Removed ci-image-builder.yml workflow - Removed Dockerfile.ci and build-ci-image.sh - Updated AGENTS.md and README.md to document the deprecation - Updated justfile to remove CI image commands The standard approach of running npm ci in each workflow is the recommended approach for Gitea Actions.
This commit is contained in:
@@ -1,80 +0,0 @@
|
||||
# CI Image Builder Workflow
|
||||
# Automatically builds and pushes CI images when dependencies change
|
||||
# Uses GitHub Container Registry (GHCR) or any container registry
|
||||
|
||||
name: CI Image Builder
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'Dockerfile.ci'
|
||||
- '.gitea/workflows/ci-image-builder.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force_rebuild:
|
||||
description: 'Force rebuild even if no changes detected'
|
||||
required: false
|
||||
default: 'false'
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
# Use your existing Docker registry
|
||||
REGISTRY: docker.notsosm.art
|
||||
IMAGE_NAME: euchre-camp-ci-runner
|
||||
|
||||
jobs:
|
||||
build-ci-image:
|
||||
runs-on: ubuntu-latest
|
||||
# Skip if this is an auto-generated version bump commit
|
||||
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build CI image
|
||||
run: |
|
||||
docker build \
|
||||
-f Dockerfile.ci \
|
||||
-t ${{ env.IMAGE_NAME }}:latest \
|
||||
-t ${{ env.IMAGE_NAME }}:$(git rev-parse --short HEAD) \
|
||||
.
|
||||
|
||||
- name: Test CI image
|
||||
run: |
|
||||
docker run --rm \
|
||||
${{ env.IMAGE_NAME }}:latest \
|
||||
sh -c "node --version && npm --version && npx prisma --version"
|
||||
|
||||
- name: Push to registry
|
||||
run: |
|
||||
echo "Pushing to ${{ env.REGISTRY }}..."
|
||||
# Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets
|
||||
if [ -n "${{ secrets.DOCKER_LOGIN }}" ] && [ -n "${{ secrets.DOCKER_PASSWORD }}" ]; then
|
||||
if docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }} 2>/dev/null; then
|
||||
docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
echo "Successfully pushed CI image to ${{ env.REGISTRY }}"
|
||||
else
|
||||
echo "Warning: Docker login failed with provided credentials"
|
||||
echo "CI image built locally but not pushed to registry"
|
||||
fi
|
||||
else
|
||||
echo "Warning: DOCKER_LOGIN or DOCKER_PASSWORD secrets not configured"
|
||||
echo "CI image built locally but not pushed to registry"
|
||||
fi
|
||||
|
||||
- name: Show usage instructions
|
||||
run: |
|
||||
echo "CI Image built successfully!"
|
||||
echo ""
|
||||
echo "To use in workflows:"
|
||||
echo " container:"
|
||||
echo " image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
||||
+16
-13
@@ -9,19 +9,15 @@ jobs:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||
image: node:20-alpine
|
||||
options: --user root
|
||||
env:
|
||||
NODE_PATH: /workspace/david/euchre_camp/node_modules
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Link node_modules from container
|
||||
run: |
|
||||
# Create symlink from container's node_modules to workspace
|
||||
ln -sf /app/node_modules /workspace/david/euchre_camp/node_modules
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run unit tests
|
||||
run: npm run test:run
|
||||
@@ -30,22 +26,29 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: unit-tests
|
||||
container:
|
||||
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||
image: mcr.microsoft.com/playwright:v1.58.0-jammy
|
||||
options: --user root
|
||||
env:
|
||||
DATABASE_PROVIDER: sqlite
|
||||
DATABASE_URL: file:./prisma/ci.db
|
||||
BETTER_AUTH_SECRET: test-secret-key-for-ci-only
|
||||
NODE_PATH: /workspace/david/euchre_camp/node_modules
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Link node_modules from container
|
||||
run: |
|
||||
# Create symlink from container's node_modules to workspace
|
||||
ln -sf /app/node_modules /workspace/david/euchre_camp/node_modules
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: npx prisma generate
|
||||
env:
|
||||
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
|
||||
|
||||
- name: Setup SQLite database
|
||||
run: |
|
||||
|
||||
@@ -9,21 +9,17 @@ jobs:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||
image: node:20-alpine
|
||||
options: --user root
|
||||
# Skip if this is an auto-generated version bump commit (handled by release workflow)
|
||||
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||
env:
|
||||
NODE_PATH: /workspace/david/euchre_camp/node_modules
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Link node_modules from container
|
||||
run: |
|
||||
# Create symlink from container's node_modules to workspace
|
||||
ln -sf /app/node_modules /workspace/david/euchre_camp/node_modules
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run unit tests
|
||||
run: npm run test:run
|
||||
|
||||
Reference in New Issue
Block a user