Repository navigation
Readonly and Required of a class are the class itself #92
This file contains hidden or 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: 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 |