This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
Ecosystem CI #1884
This file contains 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: Ecosystem CI | |
env: | |
CI: 1 | |
# 7 GiB by default on GitHub, setting to 6 GiB | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
NODE_OPTIONS: --max-old-space-size=6144 | |
FNM_COREPACK_ENABLED: true | |
FNM_RESOLVE_ENGINES: true | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "swc version to use" | |
required: true | |
type: string | |
default: "nightly" | |
suites: | |
description: 'JSON array for test suites to run. Select ["_"] to run all tests' | |
required: true | |
type: string | |
mode: | |
type: choice | |
description: "Passing is a regular proces, and ignored is about ignored tests" | |
options: | |
- "passing" | |
- "ignored" | |
jobs: | |
execute-selected-suite: | |
name: Test ${{ matrix.suite }} with ${{ inputs.version }} | |
timeout-minutes: 30 | |
concurrency: | |
group: swc-ci-project=${{ matrix.suite }} | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
suite: ${{ fromJSON(github.event.inputs.suites )}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: | | |
curl -fsSL https://fnm.vercel.app/install | bash | |
- run: | | |
export PATH="/home/runner/.local/share/fnm:$PATH" | |
echo "/home/runner/.local/share/fnm" >> $GITHUB_PATH | |
fnm env --json | jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' | xargs -I {} echo "{}" >> $GITHUB_ENV | |
- run: | | |
export PATH="/home/runner/.local/share/fnm:$PATH" | |
eval "$(fnm env --use-on-cd)" | |
echo $PATH | |
fnm use --install-if-missing 18 | |
which node | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- run: pnpm --version | |
- run: pnpm i --frozen-lockfile | |
- run: | | |
export PATH="/home/runner/.local/share/fnm:$PATH" | |
eval "$(fnm env --use-on-cd)" | |
bash -r | |
echo $PATH | |
which node | |
pnpm tsx ecosystem-ci.ts run-suites ${{ matrix.suite }} | |
env: | |
SWC_VERSION: ${{ inputs.version }} | |
CI_MODE: ${{ inputs.mode }} | |
id: ecosystem-ci-run | |
- if: ${{ github.event.inputs.mode == 'passing' }} | |
name: Download previous result | |
uses: actions/checkout@v4 | |
with: | |
repository: swc-project/raw-green-data | |
path: "green-data" | |
- if: ${{ (success() || failure()) && github.event.inputs.mode == 'passing' }} | |
name: "Last" | |
run: | | |
mkdir -p green-data/${{ matrix.suite }} | |
echo "${{ job.status }}" > green-data/${{ matrix.suite }}/last.txt | |
- if: ${{ success() && github.event.inputs.mode == 'passing' }} | |
name: "Mark last success" | |
run: | | |
echo "https://github.com/swc-project/swc-ecosystem-ci/actions/runs/${{ github.run_id }}" > green-data/${{ matrix.suite }}/last-success.txt | |
- if: ${{ (success() || failure()) && github.event.inputs.mode == 'passing' }} | |
name: Upload result | |
uses: JamesIves/[email protected] | |
continue-on-error: true | |
with: | |
token: ${{ secrets.BOT_GH_TOKEN }} | |
branch: main | |
folder: green-data | |
clean: false | |
single-commit: false | |
git-config-email: [email protected] | |
repository-name: swc-project/raw-green-data | |
commit-message: "Update ${{ matrix.suite }}: ${{ job.status }}" | |
- if: ${{ failure() && github.event.inputs.mode == 'passing' }} | |
name: Notify failure | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
content: | | |
Test for `${{ matrix.suite }}` with `${{ inputs.version }}` failed. | |
See https://github.com/swc-project/swc-ecosystem-ci/actions/runs/${{ github.run_id }} for details. | |
- if: ${{ success() &&github.event.inputs.mode == 'ignored' }} | |
name: Notify success | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
content: | | |
Test `${{ matrix.suite }}` is now passing |