Files
bun.sh/.github/workflows/run-test.yml
2024-06-27 14:56:07 -07:00

178 lines
5.4 KiB
YAML

name: Test
permissions:
contents: read
actions: read
on:
workflow_call:
inputs:
runs-on:
type: string
required: true
tag:
type: string
required: true
github-id:
type: string
release-name:
type: string
buildkite-url:
type: string
jobs:
test:
name: ${{ matrix.label }}
runs-on: ${{ inputs.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- label: Bundler tests
include: bundler/,transpiler/
- label: CLI tests
include: cli/
- label: Node tests
include: js/node/
- label: Bun tests
include: js/bun/
- label: Web tests
include: js/web/
- label: Integration tests
include: integration/,third_party/
- label: Other tests
exclude: bundler/,transpiler/,cli/,integration/,third_party/,js/node/,js/bun/,js/web/
steps:
- if: ${{ runner.os == 'Windows' }}
name: Setup Git
run: |
git config --system core.autocrlf false
git config --system core.eol lf
git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
package.json
bun.lockb
test
packages/bun-types
scripts
.github
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: latest
baseline: ${{ contains(inputs.tag, '-baseline') }}
- id: setup-release
if: ${{ inputs.release-name }}
name: Setup Bun from Release
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ inputs.release-name }}
baseline: ${{ contains(inputs.tag, '-baseline') }}
add-to-path: false
- id: setup-github
if: ${{ inputs.github-id }}
name: Setup Bun from Github Actions
uses: ./.github/actions/setup-bun
with:
workflow-run-id: ${{ inputs.github-id }}
baseline: ${{ contains(inputs.tag, '-baseline') }}
add-to-path: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Run Tests
id: test
timeout-minutes: 30
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 }}
run: |
node scripts/runner.node.mjs --exec-path "${{ steps.setup-github.outputs.bun-path || steps.setup-release.outputs.bun-path }}" --include "${{ matrix.include }}" --exclude "${{ matrix.exclude }}"
# TODO: Enable when we start running the Node.js test suite
# test-node:
# name: Node.js 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
# git config --system core.longpaths true
# - 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