| 1 | # BlueGit CI for Meteors: unit tests, build of build/, FTP deploy of build/. |
| 2 | # Group secrets: timftphost, timftpuser, timftppassword, timftproot (protected). |
| 3 | # Repo secret: projectftp (protected; Tim set this to $timftproot/meteors). |
| 4 | # GEEN mirror --delete: live files mogen niet verdwijnen. |
| 5 | # Deployt map build/ (NIET de repo-root). |
| 6 | stages: [test, build, deploy] |
| 7 | |
| 8 | workflow: |
| 9 | rules: |
| 10 | - if: $CI_COMMIT_TAG != "" |
| 11 | when: never |
| 12 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" |
| 13 | - if: $CI_COMMIT_BRANCH == "master" |
| 14 | - if: $CI_COMMIT_BRANCH =~ /^feature\// |
| 15 | |
| 16 | unit_tests: |
| 17 | stage: test |
| 18 | image: node:20-bookworm |
| 19 | script: |
| 20 | - node --test test/*.test.js |
| 21 | |
| 22 | build_game: |
| 23 | stage: build |
| 24 | image: debian:bookworm-slim |
| 25 | needs: [unit_tests] |
| 26 | script: |
| 27 | - apt-get update -qq && apt-get install -y -qq bash ca-certificates >/dev/null |
| 28 | - chmod +x src/build.sh |
| 29 | - ./src/build.sh |
| 30 | - test -f build/game.js |
| 31 | - test -f build/framework.js |
| 32 | - test -f build/index.html |
| 33 | - test -f build/style.css |
| 34 | - test -d build/images |
| 35 | - test -f build/images/block-ember.png |
| 36 | - test -f build/images/flame.png |
| 37 | artifacts: |
| 38 | paths: |
| 39 | - build/ |
| 40 | expire_in: 7d |
| 41 | |
| 42 | ftp_upload: |
| 43 | stage: deploy |
| 44 | image: debian:bookworm-slim |
| 45 | needs: [build_game] |
| 46 | resource_group: production |
| 47 | environment: |
| 48 | name: production |
| 49 | url: https://projects.timfalken.com/meteors/ |
| 50 | rules: |
| 51 | # Alleen master push (protected secrets). Geen feature/MR-deploys. |
| 52 | - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event" |
| 53 | script: |
| 54 | - apt-get update -qy |
| 55 | - apt-get install -y --no-install-recommends lftp python3 ca-certificates |
| 56 | - python3 ci/deploy_guard.py |
| 57 | - python3 ci/deploy.py |
projects-timfalken-com meteors