default: image: node:lts-alpine deps: needs: [] script: - npm ci cache: - key: files: - package-lock.json paths: - node_modules/ artifacts: paths: - node_modules/ check_types: needs: [deps] dependencies: [deps] script: - npm run check check_style: needs: [deps] dependencies: [deps] script: - npm run lint test_unit: needs: [deps, check_types, check_style] dependencies: [deps] script: - npm run test:unit test_db: needs: [deps, check_types, check_style] dependencies: [deps] before_script: - mkdir ../${CI_COMMIT_SHA} - cp -r ./* ../${CI_COMMIT_SHA}/ script: - cd ../${CI_COMMIT_SHA} - npx supabase db diff -f dummy_migration - git add -N supabase/migrations - > if ! git diff --exit-code --quiet supabase/migrations; then echo "Supabase migrations and schema are not in sync. See diff below:" git diff supabase/migrations exit 1 fi - npx supabase db start - npx supabase db reset - npx supabase db lint after_script: - npx supabase stop # test_e2e: # needs: [deps, check_types, check_style] # dependencies: [deps] # before_script: # - npx playwright install # script: # - npm run test:e2e build: needs: [deps, check_types, check_style, test_unit, test_db] dependencies: [deps] script: - npm run build artifacts: paths: - build/ deploy_app: needs: [deps, build] dependencies: [deps, build] before_script: - apk update - apk add openssh-client - echo "$DRP_KEY" | wc -c - echo "$DRP_KEY" | base64 -d > /tmp/drp.key - chmod 600 /tmp/drp.key script: - ssh -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null debian@drp-host.pub.home.local.koval.net -C "rm -rf /home/debian/app/build /home/debian/app/node_modules" - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r build debian@drp-host.pub.home.local.koval.net:/home/debian/app/build - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r node_modules debian@drp-host.pub.home.local.koval.net:/home/debian/app/node_modules - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null docker-compose.yml debian@drp-host.pub.home.local.koval.net:/home/debian/app/docker-compose.yml - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null package.json debian@drp-host.pub.home.local.koval.net:/home/debian/app/package.json - scp -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null package-lock.json debian@drp-host.pub.home.local.koval.net:/home/debian/app/package-lock.json - ssh -i /tmp/drp.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null debian@drp-host.pub.home.local.koval.net -C "cd /home/debian/app && docker compose down && docker compose up -d" - npx supabase db push environment: name: production url: https://drp.koval.net rules: - if: $CI_COMMIT_BRANCH != "master" when: never - when: on_success