BlueGit

projects-timfalken-com meteors

Files

meteors / blue-ci-cd.yml

blue-ci-cd.yml

blue-ci-cd.yml 3.1 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# 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). data/ (config, sqlite) wordt
6# niet geüpload; alleen data/.htaccess wordt naderhand gezet.
7# favicon.ico wordt nooit geüpload.
8stages: [test, build, deploy]
9
10workflow:
11 rules:
12 - if: $CI_COMMIT_TAG != ""
13 when: never
14 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
15 - if: $CI_COMMIT_BRANCH == "master"
16 - if: $CI_COMMIT_BRANCH =~ /^feature\//
17
18unit_tests:
19 stage: test
20 image: node:20-bookworm
21 script:
22 - apt-get update -qq && apt-get install -y -qq php-cli php-sqlite3 php-curl php-mbstring >/dev/null
23 - node --test test/*.test.js
24 - php server/tests/run.php
25
26build_game:
27 stage: build
28 image: debian:bookworm-slim
29 needs: [unit_tests]
30 script:
31 - apt-get update -qq && apt-get install -y -qq bash ca-certificates >/dev/null
32 - chmod +x src/build.sh
33 - ./src/build.sh
34 - test -f build/game.js
35 - test -f build/framework.js
36 - test -f build/index.html
37 - test -f build/style.css
38 - test -d build/images
39 - test -f build/images/block-ember.png
40 - test -f build/images/flame.png
41 - test -f build/api.php
42 - test -f build/auth.php
43 - test -f build/callback.php
44 - test -f build/logout.php
45 - test -f build/.htaccess
46 - test -f build/lib/bootstrap.php
47 - test -f build/lib/Store.php
48 - test -f build/data/.htaccess
49 - test ! -f build/data/config.php
50 - test ! -e build/data/*.sqlite
51 # BlueGit weigert directory-artifacts (IsDir → "ontbreekt"). Alleen bestanden.
52 # Afbeeldingen staan in git en zitten zo ook in de deploy-checkout.
53 artifacts:
54 paths:
55 - build/game.js
56 - build/index.html
57 - build/style.css
58 - build/framework.js
59 - build/favicon.ico
60 - build/images/block-ember.png
61 - build/images/block-aqua.png
62 - build/images/block-leaf.png
63 - build/images/block-sun.png
64 - build/images/block-orchid.png
65 - build/images/block-gray.png
66 - build/images/block-locked.png
67 - build/images/flame.png
68 - build/images/cell.png
69 - build/images/pixel.png
70 - build/images/favicon-16.png
71 - build/images/favicon-32.png
72 - build/api.php
73 - build/auth.php
74 - build/callback.php
75 - build/logout.php
76 - build/.htaccess
77 - build/lib/bootstrap.php
78 - build/lib/Store.php
79 - build/data/.htaccess
80 expire_in: 7d
81
82ftp_upload:
83 stage: deploy
84 image: debian:bookworm-slim
85 needs: [build_game]
86 resource_group: production
87 environment:
88 name: production
89 url: https://projects.timfalken.com/meteors/
90 rules:
91 # Alleen master push (protected secrets). Geen feature/MR-deploys.
92 - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"
93 script:
94 - apt-get update -qy
95 - apt-get install -y --no-install-recommends lftp python3 ca-certificates
96 - python3 ci/deploy_guard.py
97 - python3 ci/deploy.py