BlueGit

projects-timfalken-com meteors

Files

meteors / blue-ci-cd.yml

blue-ci-cd.yml

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