fix(artifacts): support exactOptionalPropertyTypes in consumers #41
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: test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: artifact_core | |
| ports: ["5457:5432"] | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| ARTIFACT_DATABASE_URL: postgres://postgres:postgres@localhost:5457/artifact_core | |
| # Package suite TRUNCATEs tables / some migration tests DROP SCHEMA — both | |
| # refuse unless opted in against an allowlisted ephemeral database name. | |
| ALLOW_DESTRUCTIVE_ARTIFACT_TESTS: "1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.14 | |
| - run: bun install --frozen-lockfile | |
| # No unpublished @workbench/* scope may leak in — it does not exist on | |
| # npm, so a leak makes the package uninstallable outside the monorepo. | |
| - name: check-deps | |
| run: bun run scripts/check-deps.ts | |
| # typecheck builds first: examples import @corbits/artifacts through the | |
| # published dist types, same path a consumer resolves. | |
| - name: typecheck | |
| run: bun run typecheck | |
| - name: unit + integration tests | |
| run: bun run test:coverage | |
| # dist/ is already emitted by typecheck; re-run for a clean package build | |
| # so acceptance and the node consumer smoke test do not depend on typecheck | |
| # having side-effected the tree. | |
| - name: build | |
| run: bun run build | |
| - name: reference-host acceptance | |
| run: bun test --cwd examples/reference-host | |
| # A consumer on plain Node must be able to install and import the | |
| # tarball; Node cannot strip types, so a src-pointing manifest would die | |
| # here rather than after publish. | |
| - name: node consumer smoke test | |
| run: | | |
| set -euo pipefail | |
| TARBALL="$(npm pack --silent)" | |
| TARBALL="$PWD/$TARBALL" | |
| mkdir -p "$RUNNER_TEMP/consumer" && cd "$RUNNER_TEMP/consumer" | |
| npm init -y >/dev/null && npm pkg set type=module >/dev/null | |
| npm install "$TARBALL" | |
| node -e ' | |
| import("@corbits/artifacts").then((m) => { | |
| for (const name of ["mountArtifacts", "runArtifactMigrations"]) { | |
| if (typeof m[name] !== "function") throw new Error(`missing export: ${name}`); | |
| } | |
| console.log("node consumer ok"); | |
| }); | |
| ' |