feat: re-writing in TS + fix all reported bugs + add all effective en… #130
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: | |
| - push | |
| - pull_request | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| node_version: | |
| - '20' | |
| - '22' | |
| - '24' | |
| - '25' | |
| name: Node ${{ matrix.node_version }} on ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node_version }} | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run lint | |
| run: yarn run lint | |
| - name: Run test coverage | |
| run: yarn run test:coverage | |
| benchmarks: | |
| runs-on: ubuntu-latest | |
| env: | |
| THRESHOLD: 50000 | |
| steps: | |
| - name: Install wrk | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wrk | |
| - name: Verify wrk installation | |
| run: | | |
| wrk --version || (echo "Error: wrk installation failed" && exit 1) | |
| # First checkout master and run benchmarks | |
| - name: Checkout master branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: master | |
| - name: Check if yarn.lock exists | |
| id: check-yarn-lock | |
| run: | | |
| if [ -f yarn.lock ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "yarn.lock found: $(wc -l < yarn.lock) lines" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "yarn.lock not found on master branch" | |
| fi | |
| - name: Setup node | |
| if: steps.check-yarn-lock.outputs.exists == 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'yarn' | |
| - name: Setup node without cache | |
| if: steps.check-yarn-lock.outputs.exists == 'false' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Install dependencies | |
| run: | | |
| if [ -f yarn.lock ]; then | |
| yarn install --frozen-lockfile | |
| else | |
| yarn install | |
| fi | |
| - name: Run benchmarks | |
| run: yarn run benchmark || echo "0" > bench-result.txt | |
| # Store output of bench-result.txt to workflow output | |
| - name: Store benchmark result | |
| id: main_benchmark | |
| run: | | |
| echo "result=$(cat bench-result.txt)" >> $GITHUB_OUTPUT | |
| # Now checkout the PR branch and run benchmarks | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| - name: Setup node for PR branch | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run benchmarks | |
| run: yarn run benchmark | |
| # Store output of bench-result.txt to workflow output | |
| - name: Store benchmark result | |
| id: branch_benchmark | |
| run: | | |
| echo "result=$(cat bench-result.txt)" >> $GITHUB_OUTPUT | |
| # Verify difference between main and branch benchmark outputs aren't greater than THRESHOLD env var | |
| - name: Verify benchmark results | |
| run: | | |
| main_result=${{ steps.main_benchmark.outputs.result }} | |
| branch_result=${{ steps.branch_benchmark.outputs.result }} | |
| difference=$(echo "$main_result - $branch_result" | bc) | |
| echo "Main benchmark result: $main_result" | |
| echo "Branch benchmark result: $branch_result" | |
| echo "Difference: $difference" | |
| if (( $(echo "$difference > $THRESHOLD" | bc -l) )); then | |
| echo "Benchmark difference exceeds threshold of $THRESHOLD" | |
| exit 1 | |
| else | |
| echo "Benchmark difference is within acceptable limit (< $THRESHOLD)." | |
| fi |