# HFY-Novels — tests op elke branch; index verversen handmatig of via een # web-pipeline op de standaardbranch. BlueGit heeft geen cron: periodiek # bijwerken doe je door deze pipeline handmatig te starten (of via de API). # # Geen tags of releases in deze pipeline. stages: [test, index] workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "web" - if: $CI_COMMIT_BRANCH != "" .test_rules: &test_rules rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "web" - if: $CI_COMMIT_BRANCH != "" test:indexer: stage: test image: bluegit/python interruptible: true timeout: 15m <<: *test_rules script: - export PYTHONPATH="$PWD" - pip install -q -r requirements-indexer.txt - python3 -m unittest discover -s indexer/tests -v - python3 indexer/build_index.py --from-fixture testdata/posts.json --dest /tmp/hfy-index --full - python3 -c "import json,pathlib; m=json.loads(pathlib.Path('/tmp/hfy-index/catalog-meta.json').read_text()); assert m['novelCount']==3" test:plugin: stage: test image: bluegit/node interruptible: true timeout: 15m <<: *test_rules script: - node scripts/build-manifest.js - node scripts/test-plugin.js test:plugin-live: stage: test image: bluegit/node interruptible: true timeout: 10m allow_failure: true needs: ["test:plugin"] <<: *test_rules variables: HFY_LIVE: "1" script: - node scripts/build-manifest.js - node scripts/test-plugin.js # Handmatig of via een web-pipeline op master. Schrijft een verse index naar # public/ als artifact. Pusht alleen terug als het geheim INDEX_PUSH_TOKEN # is gezet (een token met write_repository). CI_JOB_TOKEN kan niet pushen. update-index: stage: index image: bluegit/python timeout: 2h resource_group: update-index interruptible: false needs: ["test:indexer", "test:plugin"] rules: - if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: manual script: - export PYTHONPATH="$PWD" - pip install -q -r requirements-indexer.txt - python3 indexer/build_index.py --dest public --incremental --max-pages 200 # Wiki-catalogus + next-links; --max-pages is het API-verzoekbudget. - python3 -c "import json,pathlib; m=json.loads(pathlib.Path('public/catalog-meta.json').read_text()); print('index', m['novelCount'], 'verhalen', m['chapterCount'], 'hoofdstukken')" - bash scripts/maybe-push-index.sh artifacts: paths: - public/catalog-meta.json - public/search-index.json - public/catalog/ - public/series/ - public/covers/ - public/state.json expire_in: 30d