Implement CLI Configuration Loading and Option Handling Improvements #1313
Workflow file for this run
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: build | |
on: [push, pull_request_target] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
services: | |
rabbitmq: | |
image: rabbitmq | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
ports: | |
- 5672:5672 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
env: | |
AMQP_URL: amqp://guest:guest@localhost:5672 | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
REDIS_URL: redis://localhost:6379 | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- run: deno task test --coverage=.cov --junit-path=.test-report.xml | |
env: | |
RUST_BACKTRACE: ${{ runner.debug }} | |
LOG: ${{ runner.debug && 'always' || '' }} | |
- uses: dorny/test-reporter@v2 | |
if: success() || failure() | |
with: | |
name: "Test Results (${{ matrix.os }})" | |
path: .test-report.xml | |
reporter: jest-junit | |
continue-on-error: true | |
- if: '!cancelled()' | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: .test-report.xml | |
- run: deno coverage --lcov .cov > .cov.lcov | |
continue-on-error: true | |
- uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: .cov.lcov | |
continue-on-error: true | |
test-node: | |
runs-on: ubuntu-latest | |
services: | |
rabbitmq: | |
image: rabbitmq | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
ports: | |
- 5672:5672 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
env: | |
AMQP_URL: amqp://guest:guest@localhost:5672 | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
REDIS_URL: redis://localhost:6379 | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- run: pnpm install | |
- run: pnpm run --recursive test | |
test-bun: | |
runs-on: ubuntu-latest | |
services: | |
rabbitmq: | |
image: rabbitmq | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
ports: | |
- 5672:5672 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
env: | |
AMQP_URL: amqp://guest:guest@localhost:5672 | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
REDIS_URL: redis://localhost:6379 | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- run: pnpm install | |
- run: pnpm run --recursive test:bun | |
test-cfworkers: | |
runs-on: ubuntu-latest | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- run: deno task test:cfworkers | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- run: deno task hooks:pre-commit | |
release-test: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- run: '[[ "$(jq -r .version deno.json)" = "$(jq -r .version package.json)" ]]' | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
- run: deno task -f @fedify/fedify codegen | |
- run: deno publish --dry-run | |
- run: pnpm install | |
- run: pnpm publish --recursive --dry-run --no-git-checks | |
publish: | |
needs: [test, test-node, test-bun, test-cfworkers, lint, release-test] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
outputs: | |
version: ${{ steps.versioning.outputs.version }} | |
short_version: ${{ steps.versioning.outputs.short_version }} | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- if: github.event_name == 'push' && github.ref_type == 'branch' | |
run: | | |
jq \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
--arg commit "${GITHUB_SHA::8}" \ | |
'.version = .version + "-dev." + $build + "+" + $commit' \ | |
deno.json > deno.json.tmp | |
mv deno.json.tmp deno.json | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
- if: github.event_name == 'pull_request_target' | |
run: | | |
jq \ | |
--arg pr_number "$PR_NUMBER" \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
--arg commit "${PR_SHA::8}" \ | |
'.version = .version + "-pr." + $pr_number + "." + $build + "+" + $commit' \ | |
deno.json > deno.json.tmp | |
mv deno.json.tmp deno.json | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
PR_SHA: ${{ github.event.pull_request.head.sha }} | |
- id: versioning | |
run: | | |
set -ex | |
echo version="$(jq -r .version deno.json)" >> $GITHUB_OUTPUT | |
echo short_version="$(jq -r .version deno.json | sed 's/[+].*//')" >> $GITHUB_OUTPUT | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
- run: deno task check-versions --fix | |
- if: github.ref_type == 'tag' | |
run: | | |
set -ex | |
[[ "$(jq -r .version deno.json)" = "$GITHUB_REF_NAME" ]] | |
! grep -i "to be released" CHANGES.md | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
# Don't know why, but the .gitignore list is not overridden by include list | |
# in deno.json: | |
- run: rm src/vocab/.gitignore | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
- run: | | |
pnpm install | |
pnpm pack --recursive --filter='!./examples/**' | |
if [[ "$GITHUB_REF_TYPE" != tag ]]; then | |
rm fedify-cli-*.tgz | |
fi | |
- run: deno task pack | |
working-directory: ${{ github.workspace }}/packages/cli/ | |
- id: extract-changelog | |
uses: dahlia/submark@5a5ff0a58382fb812616a5801402f5aef00f90ce | |
with: | |
input-file: CHANGES.md | |
heading-level: 2 | |
heading-title-text: version ${{ github.ref_name }} | |
ignore-case: true | |
omit-heading: true | |
- run: 'cat "$CHANGES_FILE"' | |
env: | |
CHANGES_FILE: ${{ steps.extract-changelog.outputs.output-file }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: | | |
fedify-*.tgz | |
cli/fedify-cli-*.tar.xz | |
cli/fedify-cli-*.zip | |
- if: github.event_name == 'push' && github.ref_type == 'tag' | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: ${{ steps.extract-changelog.outputs.output-file }} | |
name: Fedify ${{ github.ref_name }} | |
files: | | |
fedify-*.tgz | |
cli/fedify-cli-*.tar.xz | |
cli/fedify-cli-*.zip | |
generate_release_notes: false | |
- run: | | |
set -ex | |
deno task -f @fedify/fedify codegen | |
if [[ "$GITHUB_EVENT_NAME" = "pull_request_target" ]]; then | |
deno publish --allow-dirty --no-provenance --token "$JSR_TOKEN" | |
else | |
deno publish --allow-dirty | |
fi | |
env: | |
JSR_TOKEN: ${{ secrets.JSR_TOKEN }} | |
- run: | | |
set -ex | |
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN" | |
for pkg in fedify-*.tgz; do | |
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then | |
npm publish --logs-dir=. --provenance --access public "$pkg" \ | |
|| grep "Cannot publish over previously published version" *.log | |
rm *.log | |
elif [[ "$GITHUB_EVENT_NAME" = "pull_request_target" ]]; then | |
npm publish \ | |
--logs-dir=. \ | |
--access public \ | |
--tag "pr-$PR_NUMBER" \ | |
"$pkg" \ | |
|| grep "Cannot publish over previously published version" *.log | |
else | |
npm publish \ | |
--logs-dir=. \ | |
--provenance \ | |
--access public \ | |
--tag dev \ | |
"$pkg" \ | |
|| grep "Cannot publish over previously published version" *.log | |
fi | |
done | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
- if: github.event_name == 'pull_request_target' | |
uses: thollander/actions-comment-pull-request@v3 | |
with: | |
pr-number: ${{ github.event.pull_request.number }} | |
comment-tag: publish | |
mode: delete | |
- if: github.event_name == 'pull_request_target' | |
uses: thollander/actions-comment-pull-request@v3 | |
with: | |
message: | | |
The latest push to this pull request has been published to JSR and npm as a pre-release: | |
| Package | Version | JSR | npm | | |
| ---------------- | --------------------------------------- | --------------------------- | --------------------------- | | |
| @fedify/fedify | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/fedify] | [npm][npm:@fedify/fedify] | | |
| @fedify/cli | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/cli] | | | |
| @fedify/amqp | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/amqp] | [npm][npm:@fedify/amqp] | | |
| @fedify/express | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/express] | [npm][npm:@fedify/express] | | |
| @fedify/h3 | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/h3] | [npm][npm:@fedify/h3] | | |
| @fedify/nestjs | ${{ steps.versioning.outputs.version }} | | [npm][npm:@fedify/nestjs] | | |
| @fedify/postgres | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/postgres] | [npm][npm:@fedify/postgres] | | |
| @fedify/redis | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/redis] | [npm][npm:@fedify/redis] | | |
| @fedify/sqlite | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/sqlite] | [npm][npm:@fedify/sqlite] | | |
| @fedify/testing | ${{ steps.versioning.outputs.version }} | [JSR][jsr:@fedify/testing] | [npm][npm:@fedify/testing] | | |
[jsr:@fedify/fedify]: https://jsr.io/@fedify/fedify@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/fedify]: https://www.npmjs.com/package/@fedify/fedify/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/cli]: https://jsr.io/@fedify/cli@${{ steps.versioning.outputs.version }} | |
[jsr:@fedify/amqp]: https://jsr.io/@fedify/amqp@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/amqp]: https://www.npmjs.com/package/@fedify/amqp/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/express]: https://jsr.io/@fedify/express@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/express]: https://www.npmjs.com/package/@fedify/express/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/h3]: https://jsr.io/@fedify/h3@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/h3]: https://www.npmjs.com/package/@fedify/h3/v/${{ steps.versioning.outputs.short_version }} | |
[npm:@fedify/nestjs]: https://www.npmjs.com/package/@fedify/nestjs/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/postgres]: https://jsr.io/@fedify/postgres@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/postgres]: https://www.npmjs.com/package/@fedify/postgres/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/redis]: https://jsr.io/@fedify/redis@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/redis]: https://www.npmjs.com/package/@fedify/redis/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/sqlite]: https://jsr.io/@fedify/sqlite@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/sqlite]: https://www.npmjs.com/package/@fedify/sqlite/v/${{ steps.versioning.outputs.short_version }} | |
[jsr:@fedify/testing]: https://jsr.io/@fedify/testing@${{ steps.versioning.outputs.version }} | |
[npm:@fedify/testing]: https://www.npmjs.com/package/@fedify/testing/v/${{ steps.versioning.outputs.short_version }} | |
pr-number: ${{ github.event.pull_request.number }} | |
comment-tag: publish | |
publish-examples-blog: | |
if: github.event_name == 'push' | |
needs: [test, lint] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- run: deno task codegen | |
working-directory: ${{ github.workspace }}/packages/fedify/ | |
- uses: denoland/deployctl@v1 | |
with: | |
project: fedify-blog | |
entrypoint: ./examples/blog/main.ts | |
root: . | |
publish-docs: | |
needs: [publish] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
pages: write | |
deployments: write | |
pull-requests: write | |
statuses: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- if: github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- run: | | |
set -ex | |
pnpm install | |
if [[ "$GITHUB_EVENT_NAME" = "push" && "$GITHUB_REF_TYPE" = "tag" ]]; then | |
EXTRA_NAV_TEXT=Unstable \ | |
EXTRA_NAV_LINK="$UNSTABLE_DOCS_URL" \ | |
SITEMAP_HOSTNAME="$STABLE_DOCS_URL" \ | |
JSR_REF_VERSION=stable \ | |
pnpm run build | |
else | |
EXTRA_NAV_TEXT=Stable \ | |
EXTRA_NAV_LINK="$STABLE_DOCS_URL" \ | |
SITEMAP_HOSTNAME="$UNSTABLE_DOCS_URL" \ | |
JSR_REF_VERSION=unstable \ | |
pnpm run build | |
fi | |
env: | |
SHORT_VERSION: ${{ needs.publish.outputs.short_version }} | |
PLAUSIBLE_DOMAIN: ${{ secrets.PLAUSIBLE_DOMAIN }} | |
STABLE_DOCS_URL: ${{ vars.STABLE_DOCS_URL }} | |
UNSTABLE_DOCS_URL: ${{ vars.UNSTABLE_DOCS_URL }} | |
working-directory: ${{ github.workspace }}/docs/ | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/.vitepress/dist | |
- id: deployment | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
uses: actions/deploy-pages@v4 | |
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
gitHubToken: ${{ github.token }} | |
command: >- | |
pages deploy .vitepress/dist | |
--project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} | |
packageManager: pnpm | |
workingDirectory: ${{ github.workspace }}/docs/ | |
- if: github.event_name == 'pull_request_target' | |
id: wrangler | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
gitHubToken: ${{ github.token }} | |
command: >- | |
pages deploy .vitepress/dist | |
--project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} | |
--branch=pr-${{ github.event.pull_request.number }} | |
packageManager: pnpm | |
workingDirectory: ${{ github.workspace }}/docs/ | |
- if: github.event_name == 'pull_request_target' | |
uses: thollander/actions-comment-pull-request@v3 | |
with: | |
message: | | |
The docs for this pull request have been published: | |
<${{ steps.wrangler.outputs.deployment-url }}> | |
pr-number: ${{ github.event.pull_request.number }} | |
comment-tag: docs | |
# cSpell: ignore submark softprops npmjs deployctl nwtgck thollander elif |