name: Test permissions: contents: read actions: read on: workflow_call: inputs: runs-on: type: string required: true tag: type: string required: true pr-number: type: string required: true run-id: type: string default: ${{ github.run_id }} jobs: test: name: Tests runs-on: ${{ inputs.runs-on }} steps: - if: ${{ runner.os == 'Windows' }} name: Setup Git run: | git config --global core.autocrlf false git config --global core.eol lf - name: Checkout uses: actions/checkout@v4 with: sparse-checkout: | package.json bun.lockb test packages/bun-internal-test packages/bun-types - name: Setup Environment shell: bash run: | echo "${{ inputs.pr-number }}" > pr-number.txt - name: Download Bun uses: actions/download-artifact@v4 with: name: bun-${{ inputs.tag }} path: bun github-token: ${{ github.token }} run-id: ${{ inputs.run-id || github.run_id }} - name: Download pnpm uses: pnpm/action-setup@v4 with: version: 8 - if: ${{ runner.os != 'Windows' }} name: Setup Bun shell: bash run: | unzip bun/bun-*.zip cd bun-* pwd >> $GITHUB_PATH - if: ${{ runner.os == 'Windows' }} name: Setup Cygwin uses: secondlife/setup-cygwin@v3 with: packages: bash - if: ${{ runner.os == 'Windows' }} name: Setup Bun (Windows) run: | unzip bun/bun-*.zip cd bun-* pwd >> $env:GITHUB_PATH - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - name: Install Dependencies timeout-minutes: 5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | bun install - name: Install Dependencies (test) timeout-minutes: 5 run: | bun install --cwd test env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install Dependencies (runner) timeout-minutes: 5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | bun install --cwd packages/bun-internal-test - name: Run Tests id: test timeout-minutes: 90 shell: bash env: IS_BUN_CI: 1 TMPDIR: ${{ runner.temp }} BUN_TAG: ${{ inputs.tag }} BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }} TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }} TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }} TEST_INFO_STRIPE: ${{ secrets.TEST_INFO_STRIPE }} TEST_INFO_AZURE_SERVICE_BUS: ${{ secrets.TEST_INFO_AZURE_SERVICE_BUS }} SHELLOPTS: igncr GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | node packages/bun-internal-test/src/runner.node.mjs $(which bun) - if: ${{ always() }} name: Upload Results uses: actions/upload-artifact@v4 with: name: bun-${{ inputs.tag }}-tests path: | test-report.* comment.md pr-number.txt if-no-files-found: error overwrite: true - if: ${{ always() && steps.test.outputs.failing_tests != '' && github.event.pull_request && github.repository_owner == 'oven-sh' }} name: Send Message uses: sarisia/actions-status-discord@v1 with: webhook: ${{ secrets.DISCORD_WEBHOOK }} nodetail: true color: "#FF0000" title: "" description: | ### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) @${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count || 'some' }} failing tests on bun-${{ inputs.tag }}. ${{ steps.test.outputs.failing_tests }} **[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})** - name: Fail if: ${{ failure() || always() && steps.test.outputs.failing_tests != '' }} run: | echo "There are ${{ steps.test.outputs.failing_tests_count || 'some' }} failing tests on bun-${{ inputs.tag }}." exit 1 test-node: name: Node.js Tests # TODO: enable when we start paying attention to the results. In the meantime, this causes CI to queue jobs wasting developer time. if: 0 runs-on: ${{ inputs.runs-on }} steps: - if: ${{ runner.os == 'Windows' }} name: Setup Git run: | git config --global core.autocrlf false git config --global core.eol lf - name: Checkout uses: actions/checkout@v4 with: sparse-checkout: | test/node.js - name: Setup Environment shell: bash run: | echo "${{ inputs.pr-number }}" > pr-number.txt - name: Download Bun uses: actions/download-artifact@v4 with: name: bun-${{ inputs.tag }} path: bun github-token: ${{ github.token }} run-id: ${{ inputs.run-id || github.run_id }} - if: ${{ runner.os != 'Windows' }} name: Setup Bun shell: bash run: | unzip bun/bun-*.zip cd bun-* pwd >> $GITHUB_PATH - if: ${{ runner.os == 'Windows' }} name: Setup Cygwin uses: secondlife/setup-cygwin@v3 with: packages: bash - if: ${{ runner.os == 'Windows' }} name: Setup Bun (Windows) run: | unzip bun/bun-*.zip cd bun-* pwd >> $env:GITHUB_PATH - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - name: Checkout Tests shell: bash working-directory: test/node.js run: | node runner.mjs --pull - name: Install Dependencies timeout-minutes: 5 shell: bash working-directory: test/node.js run: | bun install - name: Run Tests timeout-minutes: 10 # Increase when more tests are added shell: bash working-directory: test/node.js env: TMPDIR: ${{ runner.temp }} BUN_GARBAGE_COLLECTOR_LEVEL: "0" BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" run: | node runner.mjs - name: Upload Results uses: actions/upload-artifact@v4 with: name: bun-${{ inputs.tag }}-node-tests path: | test/node.js/summary/*.json if-no-files-found: error overwrite: true