This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
134 lines (114 loc) · 4.23 KB
/
swc-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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