Repository navigation
217 lines (199 loc) · 8.12 KB
/
Copy pathtests.yml
File metadata and controls
217 lines (199 loc) · 8.12 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Tests
# Builds this commit's default library with a released compiler and runs the test suite against it,
# on Windows and Linux, for every memory model. The steps follow the "Build Default Library" and
# "Test Default Library" steps of TypeScriptCompiler's create-release.yml.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
compiler_tag:
description: TypeScriptCompiler release to test against (empty - the newest one)
required: false
default: ''
env:
COMPILER_REPO: ASDAlexander77/TypeScriptCompiler
GH_TOKEN: ${{ github.token }}
jobs:
compiler:
name: Pick the compiler release
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
# Every release so far is a prerelease, which /releases/latest does not return. One tag for
# all test jobs, so they cannot straddle a release published while this run starts.
- name: Resolve the tag
id: tag
shell: bash
env:
REQUESTED_TAG: ${{ inputs.compiler_tag }}
run: |
tag="$REQUESTED_TAG"
if [ -z "$tag" ]; then
tag=$(gh api "repos/$COMPILER_REPO/releases?per_page=10" --jq '[.[] | select(.draft | not)][0].tag_name')
fi
if [ -z "$tag" ]; then echo "no release found in $COMPILER_REPO"; exit 1; fi
echo "Compiler release: $tag" | tee -a "$GITHUB_STEP_SUMMARY"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
# One job per memory model, so the models run side by side. Each job builds the library itself:
# the build takes a minute or two, far less than a model's tests.
test_windows:
name: Test (Windows, -mm=${{ matrix.model }})
needs: compiler
strategy:
fail-fast: false
matrix:
model: [gc, rc, none, own]
runs-on: windows-2025-vs2026
timeout-minutes: 120
env:
# All four together: tests.ps1 honours the library paths only alongside TOOL_PATH. A release
# package is flat, with the compiler and its libraries side by side.
TOOL_PATH: ${{ github.workspace }}\__tslang
GC_LIB_PATH: ${{ github.workspace }}\__tslang
LLVM_LIB_PATH: ${{ github.workspace }}\__tslang
TSLANG_LIB_PATH: ${{ github.workspace }}\__tslang
# the DLL build links Boehm from gc.dll (one collector per process)
GC_SHARED_LIB_PATH: ${{ github.workspace }}\__tslang\gcdll
# a release package ships only release-CRT libraries; see scripts\build_core.bat
TSLANG_DEBUG_CRT: /MT
steps:
- uses: actions/checkout@v4
# The package carries the default library of its own release. It goes, so nothing but the
# library built from this commit can be found.
- name: Download the compiler
shell: pwsh
env:
TAG: ${{ needs.compiler.outputs.tag }}
run: |
gh release download $env:TAG --repo $env:COMPILER_REPO --pattern 'tslang-*-windows-x64.zip' --output tslang.zip
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Expand-Archive -Path tslang.zip -DestinationPath $env:TOOL_PATH
Remove-Item tslang.zip
Remove-Item -Recurse -Force (Join-Path $env:TOOL_PATH 'defaultlib')
& (Join-Path $env:TOOL_PATH 'tslang.exe') --version
- name: Build the default library
shell: pwsh
run: |
$env:VSWHERE_PATH = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
.\build.bat
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# In its own pwsh: tests.ps1 reads the library paths once, at its start.
- name: Test the default library (-mm=${{ matrix.model }})
shell: pwsh
env:
MODEL: ${{ matrix.model }}
run: |
New-Item -ItemType Directory -Force results | Out-Null
pwsh -NoProfile -File .\tests.ps1 -Model $env:MODEL
$code = $LASTEXITCODE
$outcome = if ($code -eq 0) { "passing" } else { "failing" }
New-Item -ItemType File "results\windows-$env:MODEL.$outcome" | Out-Null
exit $code
# Also after a failure: the badges job reports each model from these.
- name: Keep the result for the badges
if: always()
uses: actions/upload-artifact@v4
with:
name: results-windows-${{ matrix.model }}
path: results
if-no-files-found: ignore
retention-days: 1
test_linux:
name: Test (Ubuntu 24.04, -mm=${{ matrix.model }})
needs: compiler
strategy:
fail-fast: false
matrix:
model: [gc, rc, none, own]
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
TOOL_PATH: ${{ github.workspace }}/__tslang
GC_LIB_PATH: ${{ github.workspace }}/__tslang
LLVM_LIB_PATH: ${{ github.workspace }}/__tslang
TSLANG_LIB_PATH: ${{ github.workspace }}/__tslang
steps:
- uses: actions/checkout@v4
- name: Install dependencies
shell: bash
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
# As on Windows: only the library built from this commit can be found.
- name: Download the compiler
shell: bash
env:
TAG: ${{ needs.compiler.outputs.tag }}
run: |
set -e
gh release download "$TAG" --repo "$COMPILER_REPO" --pattern 'tslang-*-ubuntu-24.04-x64.tar.gz' --output tslang.tar.gz
mkdir -p "$TOOL_PATH"
tar -xzf tslang.tar.gz -C "$TOOL_PATH"
rm tslang.tar.gz
rm -rf "$TOOL_PATH/defaultlib"
"$TOOL_PATH/tslang" --version
- name: Build the default library
shell: bash
run: ./build.sh
- name: Test the default library (-mm=${{ matrix.model }})
shell: bash
env:
MODEL: ${{ matrix.model }}
run: |
mkdir -p results
code=0
./tests.sh "$MODEL" || code=$?
if [ "$code" -eq 0 ]; then outcome=passing; else outcome=failing; fi
touch "results/linux-$MODEL.$outcome"
exit "$code"
- name: Keep the result for the badges
if: always()
uses: actions/upload-artifact@v4
with:
name: results-linux-${{ matrix.model }}
path: results
if-no-files-found: ignore
retention-days: 1
# The README's table of badges, one per OS and memory model. The badge of a workflow can only say
# how the whole of it went, so each result goes to the branch `badges` as a shields.io endpoint
# file, replacing what was there. Only a push counts: a manual run may use an older compiler.
badges:
name: Publish the status badges
needs: [test_windows, test_linux]
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Collect the results
uses: actions/download-artifact@v4
with:
pattern: results-*
path: results
merge-multiple: true
# A model with no result never got as far as its tests (the compiler download or the library
# build failed, or the job timed out), and that is a failure too.
- name: Write the badge files
shell: bash
run: |
mkdir -p site results
for os in windows linux; do
for model in gc rc none own; do
message="no result"; color=red
if [ -f "results/$os-$model.passing" ]; then message=passing; color=brightgreen; fi
if [ -f "results/$os-$model.failing" ]; then message=failing; color=red; fi
printf '{"schemaVersion":1,"label":"","message":"%s","color":"%s","cacheSeconds":300}\n' "$message" "$color" > "site/$os-$model.json"
done
done
- name: Publish them
shell: bash
working-directory: site
run: |
git init -q -b badges
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -q -m "Test status of $GITHUB_SHA"
git push --force "https://x-access-token:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.git" badges