fix(comments): continue sparse comment updates before stopping (#61) #208
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
| # CI for src folder | |
| name: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - '**' | |
| paths: | |
| - 'test/**' | |
| - 'src/**' | |
| - 'scripts/**' | |
| - 'config/**' | |
| - '.github/**' | |
| - '.yarnrc.yml' | |
| - 'package.json' | |
| - 'yarn.lock' | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'test/**' | |
| - 'src/**' | |
| - 'scripts/**' | |
| - 'config/**' | |
| - '.github/**' | |
| - '.yarnrc.yml' | |
| - 'package.json' | |
| - 'yarn.lock' | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: corepack enable | |
| - run: yarn install --immutable --mode=skip-build | |
| - run: yarn lint | |
| - run: yarn type-check | |
| - name: Run unit tests with coverage | |
| id: run_unit_tests | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=12288 | |
| run: | | |
| set -o pipefail | |
| mkdir -p .tmp | |
| LOG_FILE=.tmp/vitest-coverage.log | |
| status=0 | |
| yarn test:coverage 2>&1 | tee "$LOG_FILE" || status=$? | |
| if [ "$status" -eq 0 ]; then | |
| exit 0 | |
| fi | |
| node scripts/accept-known-vitest-worker-error.mjs "$LOG_FILE" | |
| - name: Print failed unit tests | |
| if: ${{ failure() && steps.run_unit_tests.outcome == 'failure' }} | |
| run: node .github/workflows/print-vitest-failures.cjs | |
| - name: Write coverage badge payload | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| run: node scripts/write-coverage-badge.mjs | |
| - name: Upload coverage badge artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-badge | |
| path: badges/coverage.json | |
| - run: yarn build | |
| - name: Upload dist artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| e2e: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 20 | |
| env: | |
| TEST_PKC_RPC_PORT: ${{ matrix.pkc_rpc_port }} | |
| VITE_TEST_PKC_RPC_PORT: ${{ matrix.pkc_rpc_port }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - suite: mock | |
| pkc_rpc_port: 48392 | |
| command: CHROME_BIN=$(which chromium-browser) yarn test:e2e:mock | |
| browsers: chromium | |
| - suite: chrome | |
| pkc_rpc_port: 48492 | |
| command: CHROME_BIN=$(which chromium-browser) yarn test:e2e:chrome | |
| browsers: chromium | |
| - suite: firefox | |
| pkc_rpc_port: 48592 | |
| command: FIREFOX_BIN=$(which firefox) yarn test:e2e:firefox | |
| browsers: firefox | |
| - suite: mock-content | |
| pkc_rpc_port: 48692 | |
| command: CHROME_BIN=$(which chromium-browser) yarn test:e2e:mock-content | |
| browsers: chromium | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: corepack enable | |
| - run: yarn install --immutable | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - run: sudo echo "255.255.255.255 cloudflare-ipfs.com" | sudo tee -a /etc/hosts | |
| - run: sudo echo "255.255.255.255 pubsubprovider.xyz" | sudo tee -a /etc/hosts | |
| - run: yarn playwright install ${{ matrix.browsers }} | |
| - run: yarn build | |
| - run: yarn test:server & yarn test:server:wait-on | |
| - name: Run e2e ${{ matrix.suite }} tests | |
| id: run_e2e | |
| run: ${{ matrix.command }} | |
| - name: Print failed e2e ${{ matrix.suite }} tests | |
| if: ${{ failure() && steps.run_e2e.outcome == 'failure' }} | |
| run: node .github/workflows/print-vitest-failures.cjs | |
| dist: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 10 | |
| needs: [checks, e2e] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.14.0' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: corepack enable | |
| - run: yarn install --immutable --mode=skip-build | |
| - name: Download dist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Download coverage badge artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage-badge | |
| path: badges/ | |
| - name: Upgrade npm for trusted publishing | |
| run: npm install -g npm@11 | |
| - name: Check if package version already exists | |
| id: check_npm_version | |
| env: | |
| NODE_AUTH_TOKEN: '' | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" | |
| if npm view @bitsocial/bitsocial-react-hooks@$PACKAGE_VERSION version 2>/dev/null; then | |
| echo "Version $PACKAGE_VERSION already exists on npm, skipping publish" | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version $PACKAGE_VERSION not found on npm, will publish" | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Generate changelog | |
| if: steps.check_npm_version.outputs.exists == 'false' | |
| run: yarn changelog | |
| - name: Write GitHub release notes | |
| if: steps.check_npm_version.outputs.exists == 'false' | |
| run: | | |
| mkdir -p .tmp | |
| yarn changelog:release-notes "${{ steps.check_npm_version.outputs.version }}" > .tmp/release-notes.md | |
| - run: git add dist badges/coverage.json CHANGELOG.md --force | |
| - run: git status | |
| - uses: stefanzweifel/git-auto-commit-action@v4 | |
| id: dist_commit | |
| with: | |
| commit_message: 'chore(ci): update release artifacts' | |
| file_pattern: 'dist badges/coverage.json CHANGELOG.md' | |
| add_options: '--force' | |
| branch: ${{ github.ref_name }} | |
| - name: Publish to npm | |
| if: steps.check_npm_version.outputs.exists == 'false' | |
| env: | |
| NODE_AUTH_TOKEN: '' | |
| run: npm publish --access public --provenance | |
| - name: Create GitHub release | |
| if: steps.check_npm_version.outputs.exists == 'false' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_TAG: ${{ steps.check_npm_version.outputs.tag }} | |
| run: | | |
| if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then | |
| echo "Release $RELEASE_TAG already exists, skipping" | |
| exit 0 | |
| fi | |
| gh release create "$RELEASE_TAG" \ | |
| --target "$GITHUB_SHA" \ | |
| --title "$RELEASE_TAG" \ | |
| --notes-file .tmp/release-notes.md \ | |
| --latest |