fix: mount /apps and docker socket in PR workflow build-and-deploy-ci job (#41)
Reviewed-on: #41 Co-authored-by: David Gwilliam <dhgwilliam@gmail.com> Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
This commit was merged in pull request #41.
This commit is contained in:
+21
-15
@@ -15,21 +15,21 @@ jobs:
|
||||
container:
|
||||
image: docker.notsosm.art/euchre-camp/ci-base:latest
|
||||
options: --user root
|
||||
env:
|
||||
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: bun x prisma generate
|
||||
env:
|
||||
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
|
||||
run: npx prisma generate
|
||||
|
||||
- name: Run unit tests
|
||||
run: bun test src/__tests__/unit/ src/__tests__/*.test.tsx src/__tests__/auth-simple.test.ts
|
||||
run: npm test
|
||||
|
||||
build-and-deploy-ci:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -37,16 +37,20 @@ jobs:
|
||||
container:
|
||||
image: docker.notsosm.art/euchre-camp/ci-base:latest
|
||||
options: --user root
|
||||
volumes:
|
||||
- /var/lib/casaos/apps:/apps
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Required for acceptance tests - they import prisma via @/ path alias
|
||||
# and @cucumber/cucumber for cucumber-e2e tests
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: bun x prisma generate
|
||||
run: npx prisma generate
|
||||
env:
|
||||
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
|
||||
|
||||
@@ -73,33 +77,34 @@ jobs:
|
||||
# Update the image tag in the compose file
|
||||
sed -i "s|image: docker.notsosm.art/euchre-camp:[a-zA-Z0-9.-]*|image: docker.notsosm.art/euchre-camp:${IMAGE_TAG}|" ${COMPOSE_FILE}
|
||||
|
||||
# Pull the new image and restart the CI stack
|
||||
# Image was built locally in the previous step; compose uses it without pulling
|
||||
cd /apps/euchre_camp_ci
|
||||
docker compose pull app
|
||||
docker compose up -d app
|
||||
|
||||
- name: Wait for CI site to be healthy
|
||||
- name: Wait for CI site to be ready
|
||||
run: |
|
||||
for i in {1..30}; do
|
||||
echo "Waiting for Next.js to start..."
|
||||
sleep 20
|
||||
for i in {1..6}; do
|
||||
if curl -sf https://euchre-ci.notsosm.art/api/health > /dev/null 2>&1; then
|
||||
echo "CI site is healthy"
|
||||
exit 0
|
||||
fi
|
||||
sleep 0.5
|
||||
sleep 15
|
||||
done
|
||||
echo "CI site failed to become healthy after 15 seconds"
|
||||
echo "CI site failed to become healthy after 90 seconds"
|
||||
docker compose -f /apps/euchre_camp_ci/docker-compose.yml logs app
|
||||
exit 1
|
||||
|
||||
- name: Run acceptance tests
|
||||
run: DATABASE_URL="${{ secrets.CI_DATABASE_URL }}" bun test:acceptance
|
||||
run: DATABASE_URL="${{ secrets.CI_DATABASE_URL }}" npx playwright test e2e/
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Cleanup PR images
|
||||
if: always()
|
||||
run: |
|
||||
docker rmi ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ steps.info.outputs.pr_number }}-${{ steps.info.outputs.short_sha }} || true
|
||||
docker rmi --force ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ steps.info.outputs.pr_number }}-${{ steps.info.outputs.short_sha }} || true
|
||||
|
||||
analyze-bump-type:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -143,6 +148,7 @@ jobs:
|
||||
echo "reason=$REASON" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Comment bump type on PR
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
|
||||
Reference in New Issue
Block a user