Run MongoDB in CI so the delete assertion executes #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: smoke | |
| on: [push, pull_request] | |
| jobs: | |
| smoke: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [24] | |
| mongodb-version: [8] | |
| env: | |
| SECRET: ci-secret-not-used-outside-this-job | |
| PUBLICATION_URL: http://localhost:8080 | |
| INDIEKIT_URL: http://localhost:3000 | |
| # With a database the delete assertion runs for real; without one the | |
| # smoke test skips it (getindiekit/indiekit#904). | |
| MONGO_URL: mongodb://localhost:27017/indiekit | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # Same action upstream Indiekit uses in its own build workflow. | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@1.12.1 | |
| with: | |
| mongodb-version: ${{ matrix.mongodb-version }} | |
| - run: npm install | |
| # Servers and tests share one step: each `run:` is a separate shell, so a | |
| # server backgrounded in an earlier step is gone by the time tests run. | |
| - name: Publish, build and verify | |
| run: | | |
| export PASSWORD_SECRET="$(node -e "require('bcrypt').hash('ci',10).then(h=>console.log(h))")" | |
| npx indiekit serve --port 3000 & | |
| npm run build | |
| npx http-server _site -p 8080 -s & | |
| for _ in $(seq 1 30); do | |
| curl -sf -o /dev/null "$INDIEKIT_URL/" && break; sleep 1 | |
| done | |
| for _ in $(seq 1 30); do | |
| curl -sf -o /dev/null "$PUBLICATION_URL/" && break; sleep 1 | |
| done | |
| npm run smoke | |
| npm run test:types |