| 1 | # BlueGit CI for Meteors: unit tests, build of build/, FTP deploy of build/. |
| 2 | # Group secrets: timftphost, timftpuser, timftppassword, timftproot (protected). |
| 3 | # The group (and verhalenboek / microchess) has no auth.timfalken.com secret. |
| 4 | # Repo secrets (protected, master only): |
| 5 | # projectftp — Tim set this to $timftproot/meteors. |
| 6 | # auth_client_secret — existing auth.timfalken.com client secret for |
| 7 | # client_id projects.timfalken.com. If non-empty, deploy writes |
| 8 | # data/config.php (never logged). If empty/unset, an existing file |
| 9 | # is left alone. Optional: auth_client_id (defaults to that client_id). |
| 10 | # GEEN mirror --delete: live files mogen niet verdwijnen. |
| 11 | # Deployt map build/ (NIET de repo-root). data/ (sqlite, sessies) wordt |
| 12 | # niet gespiegeld; data/.htaccess wordt naderhand gezet, en config.php |
| 13 | # alleen vanuit het CI-geheim. |
| 14 | # favicon.ico wordt nooit geüpload. |
| 15 | stages: [test, build, deploy] |
| 16 | |
| 17 | workflow: |
| 18 | rules: |
| 19 | - if: $CI_COMMIT_TAG != "" |
| 20 | when: never |
| 21 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 22 | - if: $CI_COMMIT_BRANCH == "master" |
| 23 | - if: $CI_COMMIT_BRANCH =~ /^feature\// |
| 24 | |
| 25 | unit_tests: |
| 26 | stage: test |
| 27 | image: node:20-bookworm |
| 28 | script: |
| 29 | - apt-get update -qq && apt-get install -y -qq php-cli php-sqlite3 php-curl php-mbstring >/dev/null |
| 30 | - node --test test/*.test.js |
| 31 | - python3 ci/test_deploy_auth.py |
| 32 | - php server/tests/run.php |
| 33 | |
| 34 | build_game: |
| 35 | stage: build |
| 36 | image: debian:bookworm-slim |
| 37 | needs: [unit_tests] |
| 38 | script: |
| 39 | - apt-get update -qq && apt-get install -y -qq bash ca-certificates >/dev/null |
| 40 | - chmod +x src/build.sh |
| 41 | - ./src/build.sh |
| 42 | - test -f build/game.js |
| 43 | - test -f build/framework.js |
| 44 | - test -f build/index.html |
| 45 | - test -f build/style.css |
| 46 | - test -d build/images |
| 47 | - test -f build/images/block-ember.png |
| 48 | - test -f build/images/flame.png |
| 49 | - test -f build/api.php |
| 50 | - test -f build/auth.php |
| 51 | - test -f build/callback.php |
| 52 | - test -f build/logout.php |
| 53 | - test -f build/.htaccess |
| 54 | - test -f build/lib/bootstrap.php |
| 55 | - test -f build/lib/Store.php |
| 56 | - test -f build/data/.htaccess |
| 57 | - test ! -f build/data/config.php |
| 58 | - test ! -e build/data/*.sqlite |
| 59 | # BlueGit weigert directory-artifacts (IsDir → "ontbreekt"). Alleen bestanden. |
| 60 | # Afbeeldingen staan in git en zitten zo ook in de deploy-checkout. |
| 61 | artifacts: |
| 62 | paths: |
| 63 | - build/game.js |
| 64 | - build/index.html |
| 65 | - build/style.css |
| 66 | - build/framework.js |
| 67 | - build/favicon.ico |
| 68 | - build/images/block-ember.png |
| 69 | - build/images/block-aqua.png |
| 70 | - build/images/block-leaf.png |
| 71 | - build/images/block-sun.png |
| 72 | - build/images/block-orchid.png |
| 73 | - build/images/block-gray.png |
| 74 | - build/images/block-locked.png |
| 75 | - build/images/flame.png |
| 76 | - build/images/cell.png |
| 77 | - build/images/pixel.png |
| 78 | - build/images/favicon-16.png |
| 79 | - build/images/favicon-32.png |
| 80 | - build/api.php |
| 81 | - build/auth.php |
| 82 | - build/callback.php |
| 83 | - build/logout.php |
| 84 | - build/.htaccess |
| 85 | - build/lib/bootstrap.php |
| 86 | - build/lib/Store.php |
| 87 | - build/data/.htaccess |
| 88 | expire_in: 7d |
| 89 | |
| 90 | ftp_upload: |
| 91 | stage: deploy |
| 92 | image: debian:bookworm-slim |
| 93 | needs: [build_game] |
| 94 | resource_group: production |
| 95 | environment: |
| 96 | name: production |
| 97 | url: https://projects.timfalken.com/meteors/ |
| 98 | rules: |
| 99 | # Alleen master push (protected secrets). Geen feature/MR-deploys. |
| 100 | - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event" |
| 101 | script: |
| 102 | - apt-get update -qy |
| 103 | - apt-get install -y --no-install-recommends lftp python3 ca-certificates |
| 104 | - python3 ci/deploy_guard.py |
| 105 | - python3 ci/deploy.py |
projects-timfalken-com meteors