Multi-package setup: types/zod + legacy wrapper #477
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: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| schedule: | |
| - cron: '0 8 * * *' | |
| jobs: | |
| pack: | |
| name: Build package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: corepack yarn | |
| - run: corepack yarn run pack | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: package | |
| path: '*.tgz' | |
| biome: | |
| name: Lint (Biome) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: corepack yarn | |
| - run: corepack yarn lint:js | |
| knip: | |
| name: Knip | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: corepack yarn | |
| - run: corepack yarn knip | |
| typescript: | |
| name: Lint (TypeScript) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: corepack yarn | |
| - run: corepack yarn lint:ts | |
| unit: | |
| name: Unit tests (Node ${{ matrix.node }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node: | |
| - 20 | |
| - 22 | |
| - 24 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - run: corepack yarn | |
| # Root unit tests execute TypeScript scripts via Node's strip-types support. | |
| # Keep those on Node 24+; Node 20/22 only run @transloadit/node unit tests. | |
| - run: corepack yarn test:unit | |
| if: matrix.node == 24 | |
| - run: corepack yarn workspace @transloadit/node test:unit | |
| if: matrix.node != 24 | |
| - name: Upload coverage reports artifact | |
| if: matrix.node == 24 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-reports | |
| path: packages/node/coverage/ | |
| e2e: | |
| name: E2E tests | |
| # Run on push/schedule/dispatch, or on PRs only if from same repo (not forks) | |
| # This protects secrets from being exposed to fork PRs | |
| if: > | |
| github.event_name != 'pull_request' || | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - run: corepack yarn | |
| - name: Download cloudflared | |
| run: | | |
| curl -fsSLo cloudflared-linux-amd64 https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 | |
| chmod +x cloudflared-linux-amd64 | |
| # can be used for debugging: | |
| # - name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| - run: corepack yarn test | |
| env: | |
| TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_KEY }} | |
| TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_SECRET }} | |
| NODE_OPTIONS: --trace-deprecation --trace-warnings | |
| CLOUDFLARED_PATH: ${{ github.workspace }}/cloudflared-linux-amd64 | |
| DEBUG: 'transloadit:*' | |
| - name: Generate the badge from the json-summary | |
| run: node --experimental-strip-types packages/node/test/generate-coverage-badge.ts packages/node/coverage/coverage-summary.json | |
| - name: Move HTML report and badge to the correct location | |
| run: | | |
| mv packages/node/coverage/lcov-report static-build | |
| mv coverage-badge.svg static-build/ | |
| # *** BEGIN PUBLISH STATIC SITE STEPS *** | |
| # Use the standard checkout action to check out the destination repo to a separate directory | |
| # See https://github.com/mifi/github-action-push-static | |
| - uses: actions/checkout@v4 | |
| with: | |
| ssh-key: ${{ secrets.COVERAGE_REPO_SSH_PRIVATE_KEY }} | |
| repository: transloadit/node-sdk-coverage | |
| path: static-files-destination | |
| # Push coverage data | |
| - run: | | |
| git config --global user.name github-actions | |
| git config --global user.email github-actions@github.com | |
| # Remove existing files: | |
| rm -rf static-files-destination/* | |
| # Replace with new files: | |
| cp -a static-build/* static-files-destination/ | |
| cd static-files-destination | |
| git add . | |
| # git diff-index: to avoid doing the git commit failing if there are no changes to be commit | |
| git diff-index --quiet HEAD || git commit --message 'Static file updates' | |
| git push | |
| coverage: | |
| name: Upload coverage | |
| needs: unit | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage-reports | |
| path: coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| name: node-sdk | |
| fail_ci_if_error: true | |
| slack-on-failure: | |
| name: Slack notification | |
| needs: [e2e] | |
| if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: 8398a7/action-slack@v3 | |
| with: | |
| status: failure | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| release: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pack | |
| - biome | |
| - typescript | |
| - unit | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - uses: softprops/action-gh-release@v1 | |
| with: | |
| draft: true | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| - run: corepack yarn | |
| - run: corepack yarn changeset publish | |
| env: | |
| NPM_CONFIG_PROVENANCE: "true" |