| 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 | # BlueGit weigert directory-artifacts (IsDir → "ontbreekt"). Alleen bestanden. |
| 38 | # Afbeeldingen staan in git en zitten zo ook in de deploy-checkout. |
| 39 | artifacts: |
| 40 | paths: |
| 41 | - build/game.js |
| 42 | - build/index.html |
| 43 | - build/style.css |
| 44 | - build/framework.js |
| 45 | - build/favicon.ico |
| 46 | - build/images/block-ember.png |
| 47 | - build/images/block-aqua.png |
| 48 | - build/images/block-leaf.png |
| 49 | - build/images/block-sun.png |
| 50 | - build/images/block-orchid.png |
| 51 | - build/images/block-gray.png |
| 52 | - build/images/block-locked.png |
| 53 | - build/images/flame.png |
| 54 | - build/images/cell.png |
| 55 | - build/images/pixel.png |
| 56 | - build/images/favicon-16.png |
| 57 | - build/images/favicon-32.png |
| 58 | expire_in: 7d |
| 59 | |
| 60 | ftp_upload: |
| 61 | stage: deploy |
| 62 | image: debian:bookworm-slim |
| 63 | needs: [build_game] |
| 64 | resource_group: production |
| 65 | environment: |
| 66 | name: production |
| 67 | url: https://projects.timfalken.com/meteors/ |
| 68 | rules: |
| 69 | # Alleen master push (protected secrets). Geen feature/MR-deploys. |
| 70 | - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event" |
| 71 | script: |
| 72 | - apt-get update -qy |
| 73 | - apt-get install -y --no-install-recommends lftp python3 ca-certificates |
| 74 | - python3 ci/deploy_guard.py |
| 75 | - python3 ci/deploy.py |
projects-timfalken-com meteors