From e389b6ef1985ffe54ecae212891e85013ece8ac0 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 8 Mar 2023 08:30:53 +0200 Subject: [PATCH] run `bun test` after macOS builds (#2343) --- .github/workflows/bun-mac-aarch64.yml | 72 ++++++++++++++++++++++ .github/workflows/bun-mac-x64-baseline.yml | 1 + .github/workflows/bun-mac-x64.yml | 72 ++++++++++++++++++++++ 3 files changed, 145 insertions(+) diff --git a/.github/workflows/bun-mac-aarch64.yml b/.github/workflows/bun-mac-aarch64.yml index a6c19825ef84a0..642f20d0ccc191 100644 --- a/.github/workflows/bun-mac-aarch64.yml +++ b/.github/workflows/bun-mac-aarch64.yml @@ -384,3 +384,75 @@ jobs: name: "Canary (${{github.sha}})" tag: "canary" artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip" + macOS-test: + name: Tests ${{matrix.tag}} + runs-on: ${{ matrix.runner }} + needs: [macOS] + if: github.event_name == 'pull_request' + timeout-minutes: 10 + outputs: + failing_tests: ${{ steps.test.outputs.failing_tests }} + failing_tests_count: ${{ steps.test.outputs.failing_tests_count }} + strategy: + fail-fast: false + matrix: + include: + - tag: bun-darwin-aarch64 + runner: macos-arm64 + steps: + - id: checkout + name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + - id: download + name: Download + uses: actions/download-artifact@v3 + with: + name: ${{matrix.tag}} + path: ${{runner.temp}}/release + - id: install + name: Install + run: | + cd ${{runner.temp}}/release + unzip ${{matrix.tag}}.zip + cd ${{matrix.tag}} + chmod +x bun + sudo mv bun /usr/local/bin/bun + bun --version + - id: test + name: Test (node runner) + # if: ${{github.event.inputs.use_bun == 'false'}} + run: | + bun install + bun install --cwd test + bun install --cwd packages/bun-internal-test + node packages/bun-internal-test/src/runner.node.mjs || true + - name: Comment on PR + if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: test-failures-${{matrix.tag}} + message: | + ❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}: + + ${{ steps.test.outputs.failing_tests }} + + **[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + - name: Uncomment on PR + if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: test-failures-${{matrix.tag}} + mode: upsert + create_if_not_exists: false + message: | + ✅ test failures on ${{ matrix.tag }} have been resolved. + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + - id: fail + name: Fail the build + if: steps.test.outputs.failing_tests != '' + run: exit 1 diff --git a/.github/workflows/bun-mac-x64-baseline.yml b/.github/workflows/bun-mac-x64-baseline.yml index b2430e93b77cf4..919333fa5c395a 100644 --- a/.github/workflows/bun-mac-x64-baseline.yml +++ b/.github/workflows/bun-mac-x64-baseline.yml @@ -402,6 +402,7 @@ jobs: matrix: include: - tag: bun-darwin-x64-baseline + runner: macos-11 steps: - id: checkout name: Checkout diff --git a/.github/workflows/bun-mac-x64.yml b/.github/workflows/bun-mac-x64.yml index e4998a43ea1cdf..434c43e4e83581 100644 --- a/.github/workflows/bun-mac-x64.yml +++ b/.github/workflows/bun-mac-x64.yml @@ -390,3 +390,75 @@ jobs: name: "Canary (${{github.sha}})" tag: "canary" artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip" + macOS-test: + name: Tests ${{matrix.tag}} + runs-on: ${{ matrix.runner }} + needs: [macOS] + if: github.event_name == 'pull_request' + timeout-minutes: 10 + outputs: + failing_tests: ${{ steps.test.outputs.failing_tests }} + failing_tests_count: ${{ steps.test.outputs.failing_tests_count }} + strategy: + fail-fast: false + matrix: + include: + - tag: bun-darwin-x64 + runner: macos-11 + steps: + - id: checkout + name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + - id: download + name: Download + uses: actions/download-artifact@v3 + with: + name: ${{matrix.tag}} + path: ${{runner.temp}}/release + - id: install + name: Install + run: | + cd ${{runner.temp}}/release + unzip ${{matrix.tag}}.zip + cd ${{matrix.tag}} + chmod +x bun + sudo mv bun /usr/local/bin/bun + bun --version + - id: test + name: Test (node runner) + # if: ${{github.event.inputs.use_bun == 'false'}} + run: | + bun install + bun install --cwd test + bun install --cwd packages/bun-internal-test + node packages/bun-internal-test/src/runner.node.mjs || true + - name: Comment on PR + if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: test-failures-${{matrix.tag}} + message: | + ❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}: + + ${{ steps.test.outputs.failing_tests }} + + **[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + - name: Uncomment on PR + if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: test-failures-${{matrix.tag}} + mode: upsert + create_if_not_exists: false + message: | + ✅ test failures on ${{ matrix.tag }} have been resolved. + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + - id: fail + name: Fail the build + if: steps.test.outputs.failing_tests != '' + run: exit 1