Skip to content

refactor: optimize internal polling flow #202

refactor: optimize internal polling flow

refactor: optimize internal polling flow #202

Workflow file for this run

# This is a Github Workflow that runs tests on any push or pull request.
# If the tests pass and this is a push to the master branch it also runs Semantic Release.
name: CI
on: [push, pull_request]
env:
npm_config_audit: false
npm_config_fund: false
npm_config_save: false
npm_config_package_lock: false
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Use Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v5
with:
name: build
path: |
target
package.json
jsr.json
retention-days: 1
test:
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Fetch deps
run: npm ci
- name: Run tests
run: npm run test
- uses: actions/upload-artifact@v5
with:
name: coverage
path: |
target/coverage
package.json
retention-days: 1
release:
name: Release ${{ github.ref }}
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
# if: github.event_name == 'turned-off-temporary'
runs-on: ubuntu-latest
permissions:
checks: read
statuses: write
contents: write
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
merge-multiple: true
- name: Run release
env:
NPM_OIDC: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_USER: 'x-access-token'
GIT_BRANCH: 'main'
GIT_AUTHOR_NAME: ${{ vars.GIT_AUTHOR_NAME }}
GIT_AUTHOR_EMAIL: ${{ vars.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
run: npx zx-semrel
- name: Push docs and coverage
env:
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx ggcp target/docs https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git/gh-pages --message='chore: update docs'
npx ggcp target/coverage/lcov.info https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git/coverage/${{ github.sha }}.lcov.info --message='chore: add coverage for ${{ github.sha }}'
test-node:
needs: build
if: github.event_name == 'pull_request'
name: test-node-${{ matrix.node-version }}
strategy:
matrix:
node-version: [ 20, 24 ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- run: npm ci
- run: npm run test
smoke-node-14:
needs: build
if: github.event_name == 'pull_request'
name: smoke-node-14
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-node@v5
with:
node-version: 14
- uses: actions/download-artifact@v5
with:
name: build
- run: npm install --no-package-lock
- run: npm run test:legacy
smoke-os:
needs: build
if: github.event_name == 'pull_request'
name: smoke-${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-2022, windows-2025 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-node@v5
with:
node-version: 20
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- run: npm ci
- name: Run smoke tests
if: "!contains(matrix.os, 'windows')"
run: npm run test:unit
- name: Run smoke tests (windows)
if: contains(matrix.os, 'windows')
timeout-minutes: 2
run: npm run test:legacy
smoke-alpine:
needs: build
if: github.event_name == 'pull_request'
name: smoke-alpine-busybox
runs-on: ubuntu-24.04
container: node:20-alpine
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/download-artifact@v5
with:
name: build
- name: Verify BusyBox ps
run: |
which busybox && busybox --list | grep -w ps
ps -eo pid,ppid,args | head -5
- run: npm ci
- run: npm run test:unit