From 7fbf54bfe60e070c9462dd79824d12993909ce4a Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Wed, 15 Jan 2025 12:30:10 +0100 Subject: [PATCH] ci: smoke test with lando --- .github/workflows/tests.yml | 26 ++++++++++---------------- .lando.yml | 34 ++++++++++++++++++++++++++++++++++ example/docker-compose.yaml | 2 +- example/kopflos.config.ts | 15 +++++++++------ 4 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 .lando.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 98a9659..ac5a210 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,21 +68,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + + - uses: lando/setup-lando@v3 with: - node-version: lts/* - - run: npm ci - - run: docker compose up -d - working-directory: example - - run: npm run start:prod > api.log & - env: - log: trace - working-directory: example - - name: Wait for server to start - run: npx wait-on http://localhost:1429/plaque/newton-s-apple-tree-monash-university -t 30s - - run: npx wait-on http://localhost:1429/plaque/newton-s-apple-tree-monash-university.html -t 1s - - uses: actions/upload-artifact@v4 - if: always() + lando-version: 3.21.2 + - uses: tpluscode/action-lando-start@v0.2.2 with: - name: api log - path: example/api.log + healthcheck: http://db.read-the-plaque.lndo.site/ + timeout: 30000 + ignore-errors: true + + - run: curl https://read-the-plaque.lndo.site/plaque/newton-s-apple-tree-monash-university -If + - run: curl https://read-the-plaque.lndo.site/plaque/newton-s-apple-tree-monash-university.html -If diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 0000000..dfcc24a --- /dev/null +++ b/.lando.yml @@ -0,0 +1,34 @@ +name: read-the-plaque +services: + oxigraph: + api: 3 + type: lando + entrypoint: /usr/local/bin/oxigraph + app_mount: false + scanner: false + ssl: true + services: + image: ghcr.io/oxigraph/oxigraph:0.4.6 + user: root + command: serve --location /data --bind 0.0.0.0:7878 + ports: + - 7878 + volumes: + - ./example/oxigraph:/data + app: + type: node:20 + ssl: true + scanner: false + build: + - npm i + command: cd example; kopflos serve --mode development --trust-proxy + overrides: + environment: + API_BASE: https://read-the-plaque.lndo.site + DB_URI: http://db.read-the-plaque.lndo.site + +proxy: + oxigraph: + - db.read-the-plaque.lndo.site:7878 + app: + - read-the-plaque.lndo.site:1429 diff --git a/example/docker-compose.yaml b/example/docker-compose.yaml index 69f70c3..f91521c 100644 --- a/example/docker-compose.yaml +++ b/example/docker-compose.yaml @@ -1,6 +1,6 @@ services: oxigraph: - image: ghcr.io/oxigraph/oxigraph:0.4.4 + image: ghcr.io/oxigraph/oxigraph:0.4.6 user: root command: serve --location /data --bind 0.0.0.0:7878 ports: diff --git a/example/kopflos.config.ts b/example/kopflos.config.ts index dd28504..ce73ac7 100644 --- a/example/kopflos.config.ts +++ b/example/kopflos.config.ts @@ -1,14 +1,17 @@ import * as url from 'node:url' import type { KopflosConfig } from '@kopflos-cms/core' +const baseIri = process.env.API_BASE || 'http://localhost:1429' +const dbUri = process.env.DB_URI || 'http://localhost:7878' + export default { - baseIri: 'http://localhost:1429', - apiGraphs: ['http://localhost:1429/api'], + baseIri, + apiGraphs: [baseIri + '/api'], sparql: { default: { - endpointUrl: 'http://localhost:7878/query?union-default-graph', - updateUrl: 'http://localhost:7878/update', - storeUrl: 'http://localhost:7878/store', + endpointUrl: dbUri + '/query?union-default-graph', + updateUrl: dbUri + '/update', + storeUrl: dbUri + '/store', }, }, watch: ['lib'], @@ -28,7 +31,7 @@ export default { entrypoints: ['ui/*.html'], }, '@kopflos-cms/hydra': { - apis: ['http://localhost:1429/api'], + apis: [baseIri + '/api'], }, }, }