test should pass before image creation
Test / Type Check (all packages) (push) Successful in 1m0s
Build & Push / Pipeline Tests (push) Successful in 1m22s
Test / API Unit Tests (push) Successful in 51s
Test / Homepage Unit Tests (push) Successful in 43s
Test / Carplace Unit Tests (push) Successful in 42s
Test / Admin Unit Tests (push) Successful in 42s
Test / Dashboard Unit Tests (push) Successful in 43s
Test / API Integration Tests (push) Successful in 1m2s
Build & Push / Build & Push Docker Image (push) Successful in 53s

This commit is contained in:
root
2026-07-20 22:51:17 -04:00
parent 8f5ca1df22
commit 93fba7a318
2 changed files with 119 additions and 0 deletions
+112
View File
@@ -21,9 +21,121 @@ env:
DEPLOY_ROOT: /opt/rentaldrivego
jobs:
pipeline-tests:
name: Pipeline Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: rentaldrivego_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://postgres:password@postgres:5432/rentaldrivego_test
REDIS_URL: redis://redis:6379
NODE_ENV: test
JWT_SECRET: test-secret
JWT_EXPIRY: 8h
FILE_STORAGE_ROOT: /tmp/rentaldrivego-test-storage
steps:
- name: Checkout repository
shell: bash
env:
GITEA_SERVER_URL: ${{ gitea.server_url }}
GITEA_REPOSITORY: ${{ gitea.repository }}
GITEA_SHA: ${{ gitea.sha }}
CHECKOUT_TOKEN: ${{ gitea.token }}
run: |
set -euo pipefail
if ! command -v git >/dev/null 2>&1; then
echo "::error::git must be available in the runner image"
exit 1
fi
WORKSPACE="${GITHUB_WORKSPACE:-$PWD}"
mkdir -p "$WORKSPACE"
cd "$WORKSPACE"
SERVER_URL="${GITEA_SERVER_URL:-${GITHUB_SERVER_URL:-}}"
REPOSITORY="${GITEA_REPOSITORY:-${GITHUB_REPOSITORY:-}}"
SHA="${GITEA_SHA:-${GITHUB_SHA:-}}"
if [ -z "$SERVER_URL" ] || [ -z "$REPOSITORY" ] || [ -z "$SHA" ]; then
echo "::error::Missing repository checkout context"
exit 1
fi
REPOSITORY_URL="${SERVER_URL}/${REPOSITORY}.git"
if [ ! -d .git ]; then
git init
git remote add origin "$REPOSITORY_URL"
fi
git config --global --add safe.directory "$WORKSPACE"
if [ -n "${CHECKOUT_TOKEN:-}" ]; then
git -c "http.extraHeader=Authorization: token ${CHECKOUT_TOKEN}" fetch --no-tags --depth=1 origin "$SHA"
else
git fetch --no-tags --depth=1 origin "$SHA"
fi
git checkout --force FETCH_HEAD
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: corepack enable && corepack prepare npm@10.5.0 --activate
- name: Install dependencies
run: |
for attempt in 1 2 3; do
npm ci --include=optional && break
if [ "$attempt" = "3" ]; then
exit 1
fi
npm cache verify || true
sleep "$((attempt * 10))"
done
- name: Repair Rollup optional dependency on Linux ARM64
run: |
ARCH="$(uname -m)"
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
ROLLUP_VERSION="$(node -p "require('./node_modules/rollup/package.json').version")"
for attempt in 1 2 3; do
npm install --no-save --include=optional "@rollup/rollup-linux-arm64-gnu@$ROLLUP_VERSION" && break
if [ "$attempt" = "3" ]; then
exit 1
fi
npm cache verify || true
sleep "$((attempt * 10))"
done
node -e "require('@rollup/rollup-linux-arm64-gnu')"
fi
- run: npm run db:generate
- run: npm run type-check
- run: npm run test:api
- run: npm run test:frontends
- run: npm run db:deploy
- run: npx prisma db push --schema packages/database/prisma/schema.prisma
- run: npm run test:api:integration
build-image:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: pipeline-tests
outputs:
image_repository: ${{ steps.image-meta.outputs.repository }}
docker_image: ${{ steps.image-meta.outputs.full }}
+7
View File
@@ -120,6 +120,13 @@ integration_tests:
build_image:
stage: build
image: docker:24
needs:
- api_tests
- carplace_tests
- admin_tests
- dashboard_tests
- homepage_tests
- integration_tests
services:
- name: docker:24-dind
alias: docker