# BlueGit CI for Meteors: unit tests, build of build/, FTP deploy of build/. # Group secrets: timftphost, timftpuser, timftppassword, timftproot (protected). # The group (and verhalenboek / microchess) has no auth.timfalken.com secret. # Repo secrets (protected, master only): # projectftp — Tim set this to $timftproot/meteors. # auth_client_secret — existing auth.timfalken.com client secret for # client_id projects.timfalken.com. If non-empty, deploy writes # data/config.php (never logged). If empty/unset, an existing file # is left alone. Optional: auth_client_id (defaults to that client_id). # GEEN mirror --delete: live files mogen niet verdwijnen. # Deployt map build/ (NIET de repo-root). data/ (sqlite, sessies) wordt # niet gespiegeld; data/.htaccess wordt naderhand gezet, en config.php # alleen vanuit het CI-geheim. # favicon.ico wordt nooit geüpload. stages: [test, build, deploy] workflow: rules: - if: $CI_COMMIT_TAG != "" when: never - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH == "master" - if: $CI_COMMIT_BRANCH =~ /^feature\// unit_tests: stage: test image: node:20-bookworm script: - apt-get update -qq && apt-get install -y -qq php-cli php-sqlite3 php-curl php-mbstring >/dev/null - node --test test/*.test.js - python3 ci/test_deploy_auth.py - php server/tests/run.php build_game: stage: build image: debian:bookworm-slim needs: [unit_tests] script: - apt-get update -qq && apt-get install -y -qq bash ca-certificates >/dev/null - chmod +x src/build.sh - ./src/build.sh - test -f build/game.js - test -f build/framework.js - test -f build/index.html - test -f build/style.css - test -d build/images - test -f build/images/block-ember.png - test -f build/images/flame.png - test -f build/api.php - test -f build/auth.php - test -f build/callback.php - test -f build/logout.php - test -f build/.htaccess - test -f build/lib/bootstrap.php - test -f build/lib/Store.php - test -f build/lib/Planets.php - test -f build/lib/planets.json - test -f build/images/block-terra-ember.png - test -f build/images/block-cinder-magma.png - test -f build/data/.htaccess - test ! -f build/data/config.php - test ! -e build/data/*.sqlite # BlueGit weigert directory-artifacts (IsDir → "ontbreekt"). Alleen bestanden. # Afbeeldingen staan in git en zitten zo ook in de deploy-checkout. artifacts: paths: - build/game.js - build/index.html - build/style.css - build/framework.js - build/favicon.ico - build/images/block-ember.png - build/images/block-aqua.png - build/images/block-leaf.png - build/images/block-sun.png - build/images/block-orchid.png - build/images/block-gray.png - build/images/block-locked.png - build/images/flame.png - build/images/cell.png - build/images/pixel.png - build/images/favicon-16.png - build/images/favicon-32.png - build/api.php - build/auth.php - build/callback.php - build/logout.php - build/.htaccess - build/lib/bootstrap.php - build/lib/Store.php - build/lib/Planets.php - build/lib/planets.json - build/data/.htaccess expire_in: 7d ftp_upload: stage: deploy image: debian:bookworm-slim needs: [build_game] resource_group: production environment: name: production url: https://projects.timfalken.com/meteors/ rules: # Alleen master push (protected secrets). Geen feature/MR-deploys. - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event" script: - apt-get update -qy - apt-get install -y --no-install-recommends lftp python3 ca-certificates - python3 ci/deploy_guard.py - python3 ci/deploy.py