Pre-built TDLib #186
Workflow file for this run
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: Pre-built TDLib | ||
# This workflow can be executed using a command like this: | ||
# gh workflow run prebuilt-tdlib.yml --ref develop -f tdlib=v1.8.0 -f npm-patch=0 | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tdlib: | ||
description: 'TDLib git ref (e.g. v1.8.0 or a commit hash)' | ||
type: string | ||
required: true | ||
npm-patch: | ||
description: 'prebuilt-tdlib patch version, required to publish (e.g. 0, 1)' | ||
type: string | ||
required: false | ||
npm-tag: | ||
description: 'npm tag (e.g. latest, beta)' | ||
type: string | ||
required: false | ||
default: 'latest' | ||
jobs: | ||
build-linux-x86_64-glibc: | ||
name: 'Build TDLib / Linux x86_64 glibc' | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- name: Build TDLib | ||
run: | | ||
cd packages/prebuilt-tdlib/ci | ||
./build-linux.sh ${{ inputs.tdlib }} x86_64 gnu | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: tdlib-linux-x86_64-glibc | ||
path: ${{ env.TO_UPLOAD }} | ||
build-linux-arm64-glibc: | ||
name: 'Build TDLib / Linux arm64 glibc (cross)' | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- name: Build TDLib | ||
run: | | ||
cd packages/prebuilt-tdlib/ci | ||
./build-linux.sh ${{ inputs.tdlib }} aarch64 gnu | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: tdlib-linux-arm64-glibc | ||
path: ${{ env.TO_UPLOAD }} | ||
build-macos-x86_64: | ||
name: 'Build TDLib / macOS x86_64' | ||
runs-on: macos-13 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixpkgs-unstable | ||
- name: Build TDLib | ||
run: | | ||
cd packages/prebuilt-tdlib/ci | ||
./build-macos.sh ${{ inputs.tdlib }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: tdlib-macos-x86_64 | ||
path: ${{ env.TO_UPLOAD }} | ||
build-macos-arm64: | ||
name: 'Build TDLib / macOS arm64' | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixpkgs-unstable | ||
- name: Build TDLib | ||
run: | | ||
cd packages/prebuilt-tdlib/ci | ||
./build-macos.sh ${{ inputs.tdlib }} | ||
- name: Verify codesigning | ||
run: codesign -v ${{ env.TO_UPLOAD }}/libtdjson.dylib | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: tdlib-macos-arm64 | ||
path: ${{ env.TO_UPLOAD }} | ||
build-windows-x86_64: | ||
name: 'Build TDLib / Windows x86_64' | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 'tdlib/td' | ||
ref: ${{ inputs.tdlib }} | ||
- name: vcpkg cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: '~\AppData\Local\vcpkg\archives' | ||
key: windows-vcpkg-${{ github.run_id }} | ||
restore-keys: | | ||
windows-vcpkg- | ||
- name: Install dependencies using vcpkg | ||
run: vcpkg install gperf:x64-windows-static openssl:x64-windows-static zlib:x64-windows-static | ||
- name: CMake version | ||
run: cmake --version | ||
# NOTE: The ZLIB_USE_STATIC_LIBS option requires CMake >= 3.24 | ||
- name: Build TDLib | ||
run: | | ||
mkdir to-upload | ||
mkdir build | ||
cd build | ||
cmake -A x64 ` | ||
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake ` | ||
-DVCPKG_TARGET_TRIPLET=x64-windows-static ` | ||
-DOPENSSL_USE_STATIC_LIBS=TRUE -DZLIB_USE_STATIC_LIBS=TRUE .. | ||
cmake --build . --target tdjson --config Release --parallel 4 | ||
cd .. | ||
cp build\Release\tdjson.dll to-upload\tdjson.dll | ||
vcpkg list | Select-String openssl,zlib | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: tdlib-windows-x86_64 | ||
path: to-upload | ||
test: | ||
name: 'Test / ${{ matrix.v.bin }} / ${{ matrix.v.os }}' | ||
needs: | ||
- build-linux-x86_64-glibc | ||
- build-linux-arm64-glibc | ||
- build-macos-x86_64 | ||
- build-macos-arm64 | ||
- build-windows-x86_64 | ||
runs-on: ${{ matrix.v.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
v: | ||
# use an older ubuntu version to test the library working with | ||
# previous glibc version | ||
- os: ubuntu-22.04 | ||
bin: tdlib-linux-x86_64-glibc | ||
- os: ubuntu-24.04-arm | ||
bin: tdlib-linux-arm64-glibc | ||
- os: macos-13 | ||
bin: tdlib-macos-x86_64 | ||
- os: macos-latest | ||
bin: tdlib-macos-arm64 | ||
- os: windows-latest | ||
bin: tdlib-windows-x86_64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- run: npm install | ||
- name: Uninstall the prebuilt-tdlib dev dependency | ||
run: npm uninstall -D prebuilt-tdlib # just in case | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ matrix.v.bin }} | ||
merge-multiple: true | ||
- run: npm run test:integration | ||
env: | ||
LIBDIR_PATH: '.' | ||
publish: | ||
name: 'Publish to npm' | ||
needs: [test, test-linux-arm64] | ||
Check failure on line 173 in .github/workflows/prebuilt-tdlib.yml GitHub Actions / Pre-built TDLibInvalid workflow file
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
# registry-url is mandatory here | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm install | ||
- run: npm uninstall -D prebuilt-tdlib | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: tdlib-* | ||
path: packages/prebuilt-tdlib/prebuilds | ||
- run: tree packages/prebuilt-tdlib | ||
- run: du -hsc packages/prebuilt-tdlib/prebuilds/* | ||
env: | ||
PREBUILT_PATH: packages/prebuilt-tdlib | ||
- run: | | ||
git clone https://github.com/tdlib/td td | ||
cd td | ||
git checkout ${{ inputs.tdlib }} | ||
echo "TDLIB_COMMIT_HASH=$(git rev-parse ${{ inputs.tdlib }})" >> "$GITHUB_ENV" | ||
__ver=`grep -Po "(?<=TDLib VERSION )\d+\.\d+\.\d+" ./CMakeLists.txt` | ||
echo "TDLIB_VERSION=$__ver" >> "$GITHUB_ENV" | ||
echo NPM_TAG=${{ inputs.npm-tag }} >> "$GITHUB_ENV" | ||
- name: Publish | ||
run: node packages/prebuilt-tdlib/publish.js ${{ inputs.npm-patch }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: "${{ inputs.npm-patch != '' }}" |