Skip to content

Flatten binaries in Linux asset tarball and include default library c… #208

Flatten binaries in Linux asset tarball and include default library c…

Flatten binaries in Linux asset tarball and include default library c… #208

Workflow file for this run

name: Create Release/Upload Asset
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CACHE_VERSION: v9
LLVM_VERSION: 19
LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/map5fet7x19bm8ztsr4ma/llvm_19_1_3_release_vs2026.zip?rlkey=iwae4mz45lf7nycawa7d61g3r&st=4ee1dfug&dl=1"
LLVM_TARGZFILE: "https://www.dropbox.com/scl/fi/l9xrfupdbwqbnckr5g36p/llvm_19_1_3_release.tgz?rlkey=xubw01vl6ey3xszbph32xqfip&st=okz2ghqx&dl=1"
LLVM_UB20_TARGZFILE: "https://www.dropbox.com/scl/fi/jfs77u2moymjo57ca4r0s/llvm_19_1_3_release_UB20.tgz?rlkey=tia0bdfa07gaeidepumb1e1fy&st=np5mcrox&dl=1"
GC_VERSION: "8.2.12"
LIBATOMIC_OPS_VERSION: "7.10.0"
jobs:
build_on_windows:
name: Create/Upload Release Asset (Windows)
runs-on: windows-2025-vs2026
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build project # This would actually build your project, using zip for an example artifact
run: echo 'SELECTED_COLOR=green Build project (Windows)' >> "$GITHUB_OUTPUT"
- name: Cache Build 3rd Party
id: cache-3rd-party
uses: actions/cache@v4
with:
path: __build/llvm
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_VERSION }}-${{ env.CACHE_VERSION }}
- name: Cache 3rd Party binaries
id: cache-3rd-party-binary
uses: actions/cache@v4
with:
path: 3rdParty
key: ${{ runner.os }}-3rd-party-${{ env.LLVM_VERSION }}-${{ env.CACHE_VERSION }}
- name: Cache 3rd Party binaries - LLVM ${{ env.LLVM_VERSION }} Release
id: cache-3rd-party-binary-llvm-release
uses: actions/cache@v4
with:
path: llvm_${{ env.LLVM_VERSION }}_release.zip
key: ${{ runner.os }}-3rd-party-llvm-${{ env.LLVM_VERSION }}-release-${{ env.CACHE_VERSION }}
- name: Retrieve version
run: echo "TAG_NAME=$(git describe --abbrev=0 --tags)" >> "$GITHUB_OUTPUT"
id: version
#shell: pwsh
shell: bash
- name: Delete __Build TS folders
continue-on-error: true
run: if (Test-Path -Path ".\__build\tsc\msbuild\x64\release") { Remove-Item -Recurse -Force ".\__build\tsc\msbuild\x64\release" }
shell: pwsh
- name: Create __Build Folders
run: if (!(Test-Path -Path ".\__build\tsc\msbuild\x64\release")) { New-Item -ItemType Directory -Force -Path ".\__build\tsc\msbuild\x64\release" }; if (!(Test-Path -Path ".\__build\llvm\msbuild\x64\release")) { New-Item -ItemType Directory -Force -Path ".\__build\llvm\msbuild\x64\release" }; if (!(Test-Path -Path ".\__build\gc\msbuild\x64\release")) { New-Item -ItemType Directory -Force -Path ".\__build\gc\msbuild\x64\release" };
shell: pwsh
- name: Download 3rd party - LLVM
continue-on-error: true
shell: pwsh
run: if (!(Test-Path -Path "llvm_${{ env.LLVM_VERSION }}_release.zip")) { Invoke-WebRequest -SkipCertificateCheck -Uri "${{ env.LLVM_ZIPFILE }}" -OutFile "llvm_${{ env.LLVM_VERSION }}_release.zip" }
- name: UnZip 3rd party - LLVM
continue-on-error: false
run: if (Test-Path -Path "llvm_${{ env.LLVM_VERSION }}_release.zip") { Expand-Archive -Path "llvm_${{ env.LLVM_VERSION }}_release.zip" -DestinationPath "3rdParty\llvm\x64" -Force }
shell: pwsh
- name: Download 3rd party source - GC
continue-on-error: true
shell: pwsh
run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://github.com/bdwgc/bdwgc/releases/download/v${{ env.GC_VERSION }}/gc-${{ env.GC_VERSION }}.tar.gz" -OutFile "gc-${{ env.GC_VERSION }}.tar.gz"
- name: Download 3rd party source - GC:Atomic_ops
continue-on-error: true
shell: pwsh
run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://github.com/bdwgc/libatomic_ops/releases/download/v${{ env.LIBATOMIC_OPS_VERSION }}/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz" -OutFile "libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz"
- name: UnZip 3rd party source - GC
continue-on-error: false
run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/
shell: pwsh
- name: UnZip 3rd party source - GC:Atomic_ops
continue-on-error: false
run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/
shell: pwsh
- name: Create gc-${{ env.GC_VERSION }}\libatomic_ops Folders
run: if (!(Test-Path -Path ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops")) { New-Item -ItemType Directory -Force -Path ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops" };
shell: pwsh
- name: Copy Atomic_ops to GC
continue-on-error: false
run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}" ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops"
shell: pwsh
- name: Configure GC
continue-on-error: false
working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release
run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
shell: pwsh
- name: Build GC
continue-on-error: false
working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release
run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8
shell: pwsh
- name: Install GC
continue-on-error: false
working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release
# Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake)
# that the tsc build looks up via find_package(BDWgc CONFIG).
run: cmake --install . --config ${{ env.BUILD_TYPE }}
shell: pwsh
- name: Configure
continue-on-error: false
working-directory: ${{github.workspace}}/__build/tsc/msbuild/x64/release
run: cmake ../../../../../tsc -G "Visual Studio 18 2026" -A x64 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DTSC_PACKAGE_VERSION:STRING="${{ steps.version.outputs.TAG_NAME }}" -Wno-dev
shell: pwsh
- name: Build
continue-on-error: false
working-directory: ${{github.workspace}}/__build/tsc/msbuild/x64/release
run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8
shell: pwsh
- name: Test
working-directory: ${{github.workspace}}/__build/tsc/msbuild/x64/release
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -j1 -C ${{ env.BUILD_TYPE }} -T test --output-on-failure -T test --output-on-failure
shell: pwsh
# Replicates installDefaultLib() from tsc/defaultlib.cpp: clone the default
# library sources and build them against the tsc/gc/llvm/runtime we just built.
- name: Clone Default Library
continue-on-error: false
working-directory: ${{github.workspace}}
run: if (!(Test-Path -Path ".\TypeScriptCompilerDefaultLib")) { git clone https://github.com/ASDAlexander77/TypeScriptCompilerDefaultLib.git }
shell: pwsh
- name: Build Default Library
continue-on-error: false
working-directory: ${{github.workspace}}/TypeScriptCompilerDefaultLib
env:
TOOL_PATH: ${{github.workspace}}/__build/tsc/msbuild/x64/release/bin
GC_LIB_PATH: ${{github.workspace}}/__build/gc/msbuild/x64/release/${{ env.BUILD_TYPE }}
LLVM_LIB_PATH: ${{github.workspace}}/3rdParty/llvm/x64/release/lib
TSC_LIB_PATH: ${{github.workspace}}/__build/tsc/msbuild/x64/release/lib
run: |
$env:VSWHERE_PATH = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
.\build.bat release
shell: pwsh
- name: Create Zip of Windows Asset
working-directory: ${{github.workspace}}/__build
run: Get-ChildItem -Path .\tsc\msbuild\x64\release\bin\tsc.exe, .\tsc\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gc.lib, .\tsc\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\lib\LLVMSupport.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe, ..\TypeScriptCompilerDefaultLib\__build\release\* | Compress-Archive -DestinationPath ..\tsc.zip
shell: pwsh
- name: Archive Zip of Windows Asset
uses: actions/upload-artifact@v4
with:
name: tsc-windows-asset
path: tsc.zip
retention-days: 1
build_on_linux:
name: Create/Upload Release Asset (Ubuntu 22.04)
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Cache Build 3rd Party
id: cache-3rd-party
uses: actions/cache@v4
with:
path: __build/llvm/ninja
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_VERSION }}-${{ env.CACHE_VERSION }}
- name: Cache 3rd Party binaries
id: cache-3rd-party-binary
uses: actions/cache@v4
with:
path: 3rdParty
key: ${{ runner.os }}-3rd-party-${{ env.LLVM_VERSION }}-${{ env.CACHE_VERSION }}
- name: Cache 3rd Party binaries - LLVM ${{ env.LLVM_VERSION }} Release
id: cache-3rd-party-binary-llvm-release
uses: actions/cache@v4
with:
path: llvm_${{ env.LLVM_VERSION }}_release.tgz
key: ${{ runner.os }}-3rd-party-llvm-${{ env.LLVM_VERSION }}-release-${{ env.CACHE_VERSION }}
- name: Retrieve version
run: echo "TAG_NAME=$(git describe --abbrev=0 --tags)" >> $GITHUB_OUTPUT
id: version
- name: Delete __Build TS folders
continue-on-error: true
run: rm -R ./__build/tsc/ninja/release
shell: sh
- name: Create __Build Folders
run: mkdir -p ./__build/tsc/ninja/release; mkdir -p ./__build/gc/ninja/release
shell: sh
- name: Download 3rd party - LLVM
continue-on-error: true
shell: sh
run: |
if test ! -f "llvm_${{ env.LLVM_VERSION }}_release.tgz"; then
curl --insecure -L "${{ env.LLVM_TARGZFILE }}" --output llvm_${{ env.LLVM_VERSION }}_release.tgz
fi
- name: UnZip 3rd party - LLVM
continue-on-error: false
shell: sh
run: |
if test -f "llvm_${{ env.LLVM_VERSION }}_release.tgz"; then
file llvm_${{ env.LLVM_VERSION }}_release.tgz; mkdir -p ./3rdParty/llvm; tar -xf llvm_${{ env.LLVM_VERSION }}_release.tgz -C ./3rdParty/llvm/
fi
- name: Download 3rd party source - GC
continue-on-error: true
shell: sh
run: curl --insecure -L https://github.com/bdwgc/bdwgc/releases/download/v${{ env.GC_VERSION }}/gc-${{ env.GC_VERSION }}.tar.gz --output gc-${{ env.GC_VERSION }}.tar.gz
- name: Download 3rd party source - GC:Atomic_ops
continue-on-error: true
shell: sh
run: curl --insecure -L https://github.com/bdwgc/libatomic_ops/releases/download/v${{ env.LIBATOMIC_OPS_VERSION }}/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz --output libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz
- name: UnZip 3rd party source - GC
continue-on-error: false
shell: sh
run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/
- name: UnZip 3rd party source - GC:Atomic_ops
continue-on-error: false
shell: sh
run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/
- name: Copy Atomic_ops to GC
continue-on-error: false
shell: sh
run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/
- name: Install Ninja
continue-on-error: false
shell: sh
run: sudo apt install ninja-build
# - name: Install Clang 12
# continue-on-error: false
# shell: sh
# run: sudo apt install clang-12
- name: Configure GC
continue-on-error: false
working-directory: ${{github.workspace}}/__build/gc/ninja/release
shell: sh
run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF
- name: Build GC
continue-on-error: false
working-directory: ${{github.workspace}}/__build/gc/ninja/release
shell: sh
run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8
- name: Install GC
continue-on-error: false
working-directory: ${{github.workspace}}/__build/gc/ninja/release
shell: sh
# Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake)
# that the tsc build looks up via find_package(BDWgc CONFIG).
run: cmake --install . --config ${{ env.BUILD_TYPE }}
- name: Configure
continue-on-error: false
working-directory: ${{github.workspace}}/__build/tsc/ninja/release
shell: sh
run: cmake ../../../../tsc -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DTSC_PACKAGE_VERSION:STRING="${{ steps.version.outputs.TAG_NAME }}" -Wno-dev
- name: Build
continue-on-error: false
working-directory: ${{github.workspace}}/__build/tsc/ninja/release
shell: sh
run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 4
- name: Test
continue-on-error: false
working-directory: ${{github.workspace}}/__build/tsc/ninja/release
shell: sh
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -j1 -C ${{ env.BUILD_TYPE }} -T test --output-on-failure -T test --output-on-failure
env:
LLVM_SYMBOLIZER_PATH: ${{github.workspace}}/3rdParty/llvm/release/bin
# Replicates installDefaultLib() from tsc/defaultlib.cpp: clone the default
# library sources and build them against the tsc/gc/llvm/runtime we just built.
- name: Clone Default Library
continue-on-error: false
working-directory: ${{github.workspace}}
shell: sh
run: if [ ! -d "./TypeScriptCompilerDefaultLib" ]; then git clone https://github.com/ASDAlexander77/TypeScriptCompilerDefaultLib.git; fi
- name: Build Default Library
continue-on-error: false
working-directory: ${{github.workspace}}/TypeScriptCompilerDefaultLib
shell: sh
env:
TOOL_PATH: ${{github.workspace}}/__build/tsc/ninja/release/bin
GC_LIB_PATH: ${{github.workspace}}/__build/gc/ninja/release
LLVM_LIB_PATH: ${{github.workspace}}/3rdParty/llvm/release/lib
TSC_LIB_PATH: ${{github.workspace}}/__build/tsc/ninja/release/lib
run: chmod +x ./build.sh ./scripts/*.sh; ./build.sh release
- name: Create Tar.GZ of Linux Asset
working-directory: ${{github.workspace}}/__build
shell: sh
# Match the Windows zip layout: flatten all binaries into the archive
# root, then add the default library release contents at the root too.
run: |
rm -rf ./__stage
mkdir -p ./__stage
cp ./tsc/ninja/release/bin/tsc ./__stage/
cp ./tsc/ninja/release/lib/libTypeScriptRuntime.so ./__stage/
cp ./gc/ninja/release/libgc.a ./__stage/
cp ./tsc/ninja/release/lib/libTypeScriptAsyncRuntime.a ./__stage/
cp ../3rdParty/llvm/release/bin/wasm-ld ./__stage/
cp ../3rdParty/llvm/release/lib/libLLVMSupport.a ./__stage/
cp ../3rdParty/llvm/release/lib/libLLVMDemangle.a ./__stage/
cp -r ../TypeScriptCompilerDefaultLib/__build/release/. ./__stage/
tar -czvhf ../tsc.tar.gz -C ./__stage .
- name: Archive Tar.GZ of Linux Asset
uses: actions/upload-artifact@v4
with:
name: tsc-linux-asset
path: tsc.tar.gz
retention-days: 1
create_release:
needs: [build_on_windows, build_on_linux]
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: true
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
deploy_windows_asset:
needs: create_release
name: Upload Release (Windows)
runs-on: windows-latest
steps:
- name: Download Release Asset from Store
uses: actions/download-artifact@v4
with:
name: tsc-windows-asset
- name: Upload Release Asset (Windows)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./tsc.zip
asset_name: tsc.zip
asset_content_type: application/zip
deploy_linux_asset:
needs: create_release
name: Upload Release (Ubuntu 22.04)
runs-on: ubuntu-latest
steps:
- name: Download Release Asset from Store
uses: actions/download-artifact@v4
with:
name: tsc-linux-asset
- name: Upload Release Asset (Ubuntu 22.04)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./tsc.tar.gz
asset_name: tsc.tar.gz
asset_content_type: application/tar+gzip