BlueGit

projects-timfalken-com microchess

Files

microchess / blue-ci-cd.yml

blue-ci-cd.yml

blue-ci-cd.yml 2.1 KiB Download Raw
1# BlueGit CI (vertaald uit .gitlab-ci.yml; GitLab is alleen nog backup).
2# Secrets (repo, beschermd, gekopieerd van GitLab): timftphost, timftpuser, timftppassword, timftproot, projectftp.
3stages:
4 - test
5 - deploy
6
7php_tests:
8 stage: test
9 image: php:8.3-cli-bookworm
10 before_script:
11 - apt-get update -qq
12 - apt-get install -y --no-install-recommends python3 libonig-dev
13 - docker-php-ext-install mbstring
14 script:
15 - find web -name '*.php' -not -path '*/artifacts/*' -print0 | xargs -0 -n1 php -l
16 - php -r 'foreach (["pdo_sqlite", "curl", "mbstring", "openssl"] as $extension) { if (!extension_loaded($extension)) { fwrite(STDERR, "Missing extension " . $extension); exit(1); } }'
17 - php web/tests/chess.php
18 - php web/tests/colors.php
19 - php web/tests/feedback.php
20 - php web/tests/push.php
21 - python3 web/tests/startup.py
22 - python3 web/tests/integration.py
23
24frontend_checks:
25 stage: test
26 image: node:22-bookworm-slim
27 script:
28 - node --check web/assets/app.js
29 - node --check web/assets/pwa.js
30 - node --check web/sw.js
31 - node web/tests/pwa.mjs
32 - node --check web/tests/browser.mjs
33
34# A real FTP fixture verifies that mirroring preserves production data and secrets.
35deploy_tests:
36 stage: test
37 image: debian:bookworm-slim
38 before_script:
39 - apt-get update -qq
40 - apt-get install -y --no-install-recommends python3 python3-pyftpdlib lftp ca-certificates openssh-client
41 script:
42 - python3 ci/test_deploy.py
43
44ftp_upload:
45 stage: deploy
46 image: debian:bookworm-slim
47 resource_group: production
48 environment:
49 name: production
50 rules:
51 - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"'
52 before_script:
53 - apt-get update -qq
54 - apt-get install -y --no-install-recommends python3 lftp ca-certificates openssh-client
55 script:
56 # BlueGit expandeert $timftproot in secrets niet (GitLab deed dat wel).
57 - export projectftp="$(python3 -c 'import os;r=os.environ.get("timftproot","");print(os.environ["projectftp"].replace("${timftproot}",r).replace("$timftproot",r))')"
58 - python3 ci/deploy.py