| 1 | # BlueGit CI (git.timfalken.com). Secrets: timftp* from group projects.timfalken.com, projectftp from this repo (all protected: master only). |
| 2 | stages: |
| 3 | - test |
| 4 | - deploy |
| 5 | |
| 6 | php_tests: |
| 7 | stage: test |
| 8 | image: php:8.3-cli-bookworm |
| 9 | before_script: |
| 10 | - apt-get update -qq |
| 11 | - apt-get install -y --no-install-recommends python3 libonig-dev |
| 12 | - docker-php-ext-install mbstring |
| 13 | script: |
| 14 | - find web -name '*.php' -not -path '*/artifacts/*' -print0 | xargs -0 -n1 php -l |
| 15 | - php -r 'foreach (["pdo_sqlite", "curl", "mbstring", "openssl"] as $extension) { if (!extension_loaded($extension)) { fwrite(STDERR, "Missing extension " . $extension); exit(1); } }' |
| 16 | - php web/tests/storybook.php |
| 17 | - python3 web/tests/startup.py |
| 18 | - python3 web/tests/integration.py |
| 19 | - python3 web/tests/pwa.py |
| 20 | - python3 web/tests/feed.py |
| 21 | |
| 22 | frontend_checks: |
| 23 | stage: test |
| 24 | image: node:22-bookworm-slim |
| 25 | script: |
| 26 | - node --check web/assets/app.js |
| 27 | - node --check web/assets/pwa.js |
| 28 | - node --check web/sw.js |
| 29 | |
| 30 | # A real FTP fixture verifies that mirroring preserves production data and secrets. |
| 31 | deploy_tests: |
| 32 | stage: test |
| 33 | image: debian:bookworm-slim |
| 34 | before_script: |
| 35 | - apt-get update -qq |
| 36 | - apt-get install -y --no-install-recommends python3 python3-pyftpdlib lftp ca-certificates openssh-client |
| 37 | script: |
| 38 | - python3 ci/test_deploy.py |
| 39 | |
| 40 | ftp_upload: |
| 41 | stage: deploy |
| 42 | image: debian:bookworm-slim |
| 43 | resource_group: production |
| 44 | environment: |
| 45 | name: production |
| 46 | # Deploy only after every test job passed; a failed test means no deploy. |
| 47 | needs: [php_tests, frontend_checks, deploy_tests] |
| 48 | rules: |
| 49 | - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"' |
| 50 | before_script: |
| 51 | - apt-get update -qq |
| 52 | - apt-get install -y --no-install-recommends python3 lftp ca-certificates openssh-client |
| 53 | script: |
| 54 | - python3 ci/deploy_guard.py |
| 55 | - python3 ci/deploy.py |
| 56 | |
| 57 | # Read-only diagnosis of the live project folder (listing + .htaccess only). Manual, master only. |
| 58 | server_diagnose: |
| 59 | stage: deploy |
| 60 | image: debian:bookworm-slim |
| 61 | needs: [] |
| 62 | rules: |
| 63 | - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"' |
| 64 | when: manual |
| 65 | allow_failure: true |
| 66 | before_script: |
| 67 | - apt-get update -qq |
| 68 | - apt-get install -y --no-install-recommends python3 lftp ca-certificates openssh-client |
| 69 | script: |
| 70 | - python3 ci/diagnose.py |
| 71 | |
| 72 | # Manual: bisect which .htaccess directive the host rejects, in throwaway _vbprobe_* dirs (removed afterwards). |
| 73 | htaccess_probe: |
| 74 | stage: deploy |
| 75 | image: debian:bookworm-slim |
| 76 | needs: [] |
| 77 | rules: |
| 78 | - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"' |
| 79 | when: manual |
| 80 | allow_failure: true |
| 81 | before_script: |
| 82 | - apt-get update -qq |
| 83 | - apt-get install -y --no-install-recommends python3 lftp ca-certificates openssh-client |
| 84 | script: |
| 85 | - python3 ci/htaccess_probe.py |
projects-timfalken-com verhalenboek