BlueGit

projects-timfalken-com meteors

Files

meteors / blue-ci-cd.yml

blue-ci-cd.yml

blue-ci-cd.yml 4.2 KiB Download Raw
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.
15stages: [test, build, deploy]
16
17workflow:
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
25unit_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
34build_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/lib/Planets.php
57 - test -f build/lib/planets.json
58 - test -f build/lib/Blocks.php
59 - test -f build/lib/blocks.json
60 - test -f build/lib/i18n.json
61 - test -f build/lib/I18n.php
62 - test -f build/images/flags/gb.svg
63 - test -f build/images/flags/nl.svg
64 - test -f build/images/flags/ja.svg || test -f build/images/flags/jp.svg
65 - test -f build/images/block-terra-ember.png
66 - test -f build/images/block-cinder-magma.png
67 - test -f build/data/.htaccess
68 - test ! -f build/data/config.php
69 - test ! -e build/data/*.sqlite
70 # BlueGit weigert directory-artifacts (IsDir → "ontbreekt"). Alleen bestanden.
71 # Afbeeldingen staan in git en zitten zo ook in de deploy-checkout.
72 artifacts:
73 paths:
74 - build/game.js
75 - build/index.html
76 - build/style.css
77 - build/framework.js
78 - build/favicon.ico
79 - build/images/block-ember.png
80 - build/images/block-aqua.png
81 - build/images/block-leaf.png
82 - build/images/block-sun.png
83 - build/images/block-orchid.png
84 - build/images/block-gray.png
85 - build/images/block-locked.png
86 - build/images/flame.png
87 - build/images/cell.png
88 - build/images/pixel.png
89 - build/images/favicon-16.png
90 - build/images/favicon-32.png
91 - build/api.php
92 - build/auth.php
93 - build/callback.php
94 - build/logout.php
95 - build/.htaccess
96 - build/lib/bootstrap.php
97 - build/lib/Store.php
98 - build/lib/Planets.php
99 - build/lib/planets.json
100 - build/lib/Blocks.php
101 - build/lib/blocks.json
102 - build/lib/i18n.json
103 - build/lib/I18n.php
104 - build/data/.htaccess
105 expire_in: 7d
106
107ftp_upload:
108 stage: deploy
109 image: debian:bookworm-slim
110 needs: [build_game]
111 resource_group: production
112 environment:
113 name: production
114 url: https://projects.timfalken.com/meteors/
115 rules:
116 # Alleen master push (protected secrets). Geen feature/MR-deploys.
117 - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"
118 script:
119 - apt-get update -qy
120 - apt-get install -y --no-install-recommends lftp python3 ca-certificates
121 - python3 ci/deploy_guard.py
122 - python3 ci/deploy.py