Skip to content

Commit

Permalink
(#66, #92) CI: separate Ubuntu 20.04 and Ubuntu 22.04 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed May 25, 2024
1 parent 58622d9 commit 5fcae1d
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 107 deletions.
170 changes: 137 additions & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- cron: 0 0 * * 1
workflow_dispatch:
jobs:
build-linux-x86-64:
build-ubuntu-20-04-x86-64:
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Cache artifacts
uses: actions/cache@v4
with:
key: linux.x86-64.${{ hashFiles('.github/cache-key.json') }}
key: ubuntu-20.04.x86-64.${{ hashFiles('.github/cache-key.json') }}
path: artifacts
- name: Install
shell: pwsh
Expand All @@ -43,7 +43,39 @@ jobs:
- name: Upload build result
uses: actions/upload-artifact@v4
with:
name: tdlib.linux.x86-64
name: tdlib.ubuntu-20.04.x86-64
path: artifacts/*
build-ubuntu-22-04-x86-64:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Generate cache key
shell: pwsh
run: ./common/Test-UpToDate.ps1 -GenerateCacheKey
- name: Cache artifacts
uses: actions/cache@v4
with:
key: ubuntu-22.04.x86-64.${{ hashFiles('.github/cache-key.json') }}
path: artifacts
- name: Install
shell: pwsh
run: ./linux/install.ps1 -ForBuild
- name: Build
shell: pwsh
run: ./linux/build.ps1
- name: Prepare artifact
shell: pwsh
run: ./linux/prepare-artifacts.ps1
- name: 'Prepare artifact: verify produced file'
shell: pwsh
run: if (!(Test-Path -LiteralPath 'artifacts/libtdjson.so')) { throw 'File not found' }
- name: Upload build result
uses: actions/upload-artifact@v4
with:
name: tdlib.ubuntu-22.04.x86-64
path: artifacts/*
build-macos-aarch64:
runs-on: macos-14
Expand Down Expand Up @@ -138,9 +170,9 @@ jobs:
with:
name: tdlib.windows.x86-64
path: artifacts/*
test-linux-x86-64:
test-ubuntu-20-04-x86-64:
needs:
- build-linux-x86-64
- build-ubuntu-20-04-x86-64
runs-on: ubuntu-20.04
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
Expand All @@ -155,11 +187,48 @@ jobs:
- name: Install
shell: pwsh
run: ./linux/install.ps1 -ForTests
- name: 'Download artifact: linux.x86-64'
- name: 'Download artifact: ubuntu-20.04.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.native.ubuntu-20.04.x86-64
path: build/tdlib.native.ubuntu-20.04-x64/runtimes/linux-x64/native
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Pack NuGet
shell: pwsh
run: dotnet pack tdlib.native.ubuntu-20.04-x64.proj -p:Version=${{ env.PACKAGE_VERSION_BASE }}-preview --output build
- name: NuGet cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}.nuget.${{ hashFiles('tdsharp/**/*.csproj') }}
path: ${{ env.NUGET_PACKAGES }}
- name: Test
shell: pwsh
run: ./common/test.ps1 -PackageName tdlib.native.ubuntu-20.04-x64 -NuGet $env:GITHUB_WORKSPACE/tools/nuget.exe -UseMono
test-ubuntu-22-04-x86-64:
needs:
- build-ubuntu-22-04-x86-64
runs-on: ubuntu-22.04
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
PACKAGE_VERSION_BASE: 1.8.21
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install
shell: pwsh
run: ./linux/install.ps1 -ForTests
- name: 'Download artifact: ubuntu-22.04.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.linux.x86-64
path: ./build/runtimes/linux-x64/native
name: tdlib.native.ubuntu-22.04.x86-64
path: build/tdlib.native.linux-x64/runtimes/linux-x64/native
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
Expand Down Expand Up @@ -192,8 +261,8 @@ jobs:
- name: 'Download artifact: macos.aarch64'
uses: actions/download-artifact@v4
with:
name: tdlib.macos.aarch64
path: ./build/runtimes/osx-arm64/native
name: tdlib.native.macos.aarch64
path: build/tdlib.native.osx-arm64/runtimes/osx-arm64/native
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
Expand Down Expand Up @@ -226,8 +295,8 @@ jobs:
- name: 'Download artifact: macos.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.macos.x86-64
path: ./build/runtimes/osx-x64/native
name: tdlib.native.macos.x86-64
path: build/tdlib.native.osx-x64/runtimes/osx-x64/native
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
Expand Down Expand Up @@ -260,8 +329,8 @@ jobs:
- name: 'Download artifact: windows.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.windows.x86-64
path: ./build/runtimes/win-x64/native
name: tdlib.native.windows.x86-64
path: build/tdlib.native.win-x64/runtimes/win-x64/native
- name: Cache downloads for Windows
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -290,7 +359,8 @@ jobs:
run: ./common/test.ps1 -PackageName tdlib.native.win-x64 -NuGet nuget
release:
needs:
- build-linux-x86-64
- build-ubuntu-20-04-x86-64
- build-ubuntu-22-04-x86-64
- build-macos-aarch64
- build-macos-x86-64
- build-windows-x86-64
Expand All @@ -302,38 +372,46 @@ jobs:
PACKAGE_VERSION_BASE: 1.8.21
steps:
- uses: actions/checkout@v4
- name: 'Download artifact: linux.x86-64'
- name: 'Download artifact: ubuntu-20.04.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.linux.x86-64
path: ./build/runtimes/linux-x64/native
- name: 'Archive artifact for platform: linux.x86-64'
name: tdlib.native.ubuntu-20.04.x86-64
path: build/tdlib.native.ubuntu-20.04-x64/runtimes/linux-x64/native
- name: 'Archive artifact for platform: ubuntu-20.04.x86-64'
shell: pwsh
run: Set-Location ./build/runtimes/linux-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.linux.x86-64.zip *
run: Set-Location build/tdlib.native.ubuntu-20.04-x64/runtimes/linux-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.native.ubuntu-20.04.x86-64.zip *
- name: 'Download artifact: ubuntu-20.04.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.native.ubuntu-20.04.x86-64
path: build/tdlib.native.ubuntu-20.04-x64/runtimes/linux-x64/native
- name: 'Archive artifact for platform: ubuntu-20.04.x86-64'
shell: pwsh
run: Set-Location build/tdlib.native.ubuntu-20.04-x64/runtimes/linux-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.native.ubuntu-20.04.x86-64.zip *
- name: 'Download artifact: macos.aarch64'
uses: actions/download-artifact@v4
with:
name: tdlib.macos.aarch64
path: ./build/runtimes/osx-arm64/native
name: tdlib.native.macos.aarch64
path: build/tdlib.native.osx-arm64/runtimes/osx-arm64/native
- name: 'Archive artifact for platform: macos.aarch64'
shell: pwsh
run: Set-Location ./build/runtimes/osx-arm64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.macos.aarch64.zip *
run: Set-Location build/tdlib.native.osx-arm64/runtimes/osx-arm64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.native.macos.aarch64.zip *
- name: 'Download artifact: macos.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.macos.x86-64
path: ./build/runtimes/osx-x64/native
name: tdlib.native.macos.x86-64
path: build/tdlib.native.osx-x64/runtimes/osx-x64/native
- name: 'Archive artifact for platform: macos.x86-64'
shell: pwsh
run: Set-Location ./build/runtimes/osx-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.macos.x86-64.zip *
run: Set-Location build/tdlib.native.osx-x64/runtimes/osx-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.native.macos.x86-64.zip *
- name: 'Download artifact: windows.x86-64'
uses: actions/download-artifact@v4
with:
name: tdlib.windows.x86-64
path: ./build/runtimes/win-x64/native
name: tdlib.native.windows.x86-64
path: build/tdlib.native.win-x64/runtimes/win-x64/native
- name: 'Archive artifact for platform: windows.x86-64'
shell: pwsh
run: Set-Location ./build/runtimes/win-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.windows.x86-64.zip *
run: Set-Location build/tdlib.native.win-x64/runtimes/win-x64/native && zip -r $env:GITHUB_WORKSPACE/tdlib.native.windows.x86-64.zip *
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
Expand All @@ -348,7 +426,10 @@ jobs:
format: Markdown
input: ./CHANGELOG.md
output: release-notes.md
- name: 'Pack NuGet package: linux.x86-64'
- name: 'Pack NuGet package: ubuntu-20.04.x86-64'
shell: pwsh
run: dotnet pack tdlib.native.ubuntu-20.04-x64.proj -p:Version=${{ steps.version.outputs.version }} --output build
- name: 'Pack NuGet package: ubuntu-22.04.x86-64'
shell: pwsh
run: dotnet pack tdlib.native.linux-x64.proj -p:Version=${{ steps.version.outputs.version }} --output build
- name: 'Pack NuGet package: macos.aarch64'
Expand Down Expand Up @@ -385,12 +466,22 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/tags/v')
name: 'Upload archive: linux.x86-64'
name: 'Upload archive: ubuntu-20.04.x86-64'
uses: actions/upload-release-asset@v1
with:
asset_content_type: application/zip
asset_name: tdlib.ubuntu-20.04.x86-64.zip
asset_path: ./tdlib.ubuntu-20.04.x86-64.zip
upload_url: ${{ steps.release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/tags/v')
name: 'Upload archive: ubuntu-22.04.x86-64'
uses: actions/upload-release-asset@v1
with:
asset_content_type: application/zip
asset_name: tdlib.linux.x86-64.zip
asset_path: ./tdlib.linux.x86-64.zip
asset_name: tdlib.ubuntu-22.04.x86-64.zip
asset_path: ./tdlib.ubuntu-22.04.x86-64.zip
upload_url: ${{ steps.release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -424,6 +515,16 @@ jobs:
upload_url: ${{ steps.release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/tags/v')
name: 'Upload NuGet package: tdlib.native.ubuntu-20.04-x64.${{ steps.version.outputs.version }}.nupkg'
uses: actions/upload-release-asset@v1
with:
asset_content_type: application/zip
asset_name: tdlib.native.ubuntu-20.04-x64.${{ steps.version.outputs.version }}.nupkg
asset_path: ./build/tdlib.native.ubuntu-20.04-x64.${{ steps.version.outputs.version }}.nupkg
upload_url: ${{ steps.release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/tags/v')
name: 'Upload NuGet package: tdlib.native.linux-x64.${{ steps.version.outputs.version }}.nupkg'
uses: actions/upload-release-asset@v1
Expand Down Expand Up @@ -474,6 +575,9 @@ jobs:
upload_url: ${{ steps.release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Push tdlib.native.ubuntu-20.04-x64.${{ steps.version.outputs.version }} to nuget.org
run: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} ./build/tdlib.native.ubuntu-20.04-x64.${{ steps.version.outputs.version }}.nupkg
- if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Push tdlib.native.linux-x64.${{ steps.version.outputs.version }} to nuget.org
run: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} ./build/tdlib.native.linux-x64.${{ steps.version.outputs.version }}.nupkg
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ This is a project to pack [TDLib][tdlib] (the Telegram Database library) binarie

- [MacOS 11][spec.macos-11] (x86-64) _(GitHub Actions image: `macos-11`)_
- [MacOS 14][spec.macos-14] (AArch64) _(GitHub Actions image: `macos-14`)_
- [Ubuntu 20.04][spec.linux] (x86-64) _(GitHub Actions image: `ubuntu-20.04`)_
- [Ubuntu 20.04][spec.ubuntu-20.04] (x86-64) _(GitHub Actions image: `ubuntu-20.04`)_
- [Ubuntu 22.04][spec.ubuntu-22.04] (x86-64) _(GitHub Actions image: `ubuntu-22.04`)_
- [Windows Server 2019][spec.windows] (x86-64) _(GitHub Actions image: `windows-2019`)_

We aim to create a transparent process with no manual intervention, where every artifact is produced in a clean CI environment, and uploaded automatically.
Expand All @@ -15,15 +16,16 @@ Getting Started

- Install the latest package (all binaries packed for .NET SDK) from NuGet:

| Platform | Package |
|----------------|----------------------------------------------------------------------------|
| Linux x86-64 | [![NuGet][badge.tdlib.native.linux-x64]][nuget.tdlib.native.linux-x64] |
| macOS x86-64 | [![NuGet][badge.tdlib.native.osx-x64]][nuget.tdlib.native.osx-x64] |
| macOS AArch64 | [![NuGet][badge.tdlib.native.osx-arm64]][nuget.tdlib.native.osx-arm64] |
| Windows x86-64 | [![NuGet][badge.tdlib.native.windows-x64]][nuget.tdlib.native.windows-x64] |
| **All** | [![NuGet][badge.tdlib.native]][nuget.tdlib.native] |
| Platform | Package |
|-----------------------------|--------------------------------------------------------------------------------------|
| Linux x86-64 (Ubuntu 20.04) | [![NuGet][badge.tdlib.native.linux-x64]][nuget.tdlib.native.linux-x64] |
| Linux x86-64 (Ubuntu 22.04) | [![NuGet][badge.tdlib.native.ubuntu-20.04-x64]][nuget.tdlib.native.ubuntu-20.04-x64] |
| macOS x86-64 | [![NuGet][badge.tdlib.native.osx-x64]][nuget.tdlib.native.osx-x64] |
| macOS AArch64 | [![NuGet][badge.tdlib.native.osx-arm64]][nuget.tdlib.native.osx-arm64] |
| Windows x86-64 | [![NuGet][badge.tdlib.native.windows-x64]][nuget.tdlib.native.windows-x64] |
| **All** | [![NuGet][badge.tdlib.native]][nuget.tdlib.native] |

**tdlib.native** package depends on all the others, so the resulting application will work on any supported platform.
**tdlib.native** package depends on latest versions of each other platform (i.e. all except the obsolete **Ubuntu 20.04**), so the resulting application will work on any supported platform.

- Download the latest binaries from the [Releases][releases] section

Expand All @@ -34,7 +36,11 @@ For other technologies or if you don't want to use tdsharp in .NET, you can just
Library Dependencies
--------------------

On Windows, [Microsoft Visual C++ Redistributable][cpp.redist] of version 2019 or higher is required by TDLib.
On **Ubuntu 20.04**, the TDLib version provided by tdlib.native is compiled against OpenSSL 1.1.

On **Ubuntu 22.04**, the TDLib version provided by tdlib.native is compiled against OpenSSL 3.0.

On **Windows**, [Microsoft Visual C++ Redistributable][cpp.redist] of version 2019 or higher is required by TDLib.

Documentation
-------------
Expand All @@ -45,6 +51,7 @@ Documentation
- [Maintainership][docs.maintainership]

[badge.tdlib.native.linux-x64]: https://img.shields.io/nuget/v/tdlib.native.linux-x64?label=tdlib.native.linux-x64
[badge.tdlib.native.ubuntu-20.04-x64]: https://img.shields.io/nuget/v/tdlib.native.ubuntu-20.04-x64?label=tdlib.native.ubuntu-20.04-x64
[badge.tdlib.native.osx-arm64]: https://img.shields.io/nuget/v/tdlib.native.osx-arm64?label=tdlib.native.osx-arm64
[badge.tdlib.native.osx-x64]: https://img.shields.io/nuget/v/tdlib.native.osx-x64?label=tdlib.native.osx-x64
[badge.tdlib.native.windows-x64]: https://img.shields.io/nuget/v/tdlib.native.windows-x64?label=tdlib.native.windows-x64
Expand All @@ -55,12 +62,14 @@ Documentation
[docs.license]: ./LICENSE_1_0.txt
[docs.maintainership]: ./MAINTAINERSHIP.md
[nuget.tdlib.native.linux-x64]: https://www.nuget.org/packages/tdlib.native.linux-x64/
[nuget.tdlib.native.ubuntu-20.04-x64]: https://www.nuget.org/packages/tdlib.native.ubuntu-20.04-x64/
[nuget.tdlib.native.osx-arm64]: https://www.nuget.org/packages/tdlib.native.osx-arm64/
[nuget.tdlib.native.osx-x64]: https://www.nuget.org/packages/tdlib.native.osx-x64/
[nuget.tdlib.native.windows-x64]: https://www.nuget.org/packages/tdlib.native.windows-x64/
[nuget.tdlib.native]: https://www.nuget.org/packages/tdlib.native/
[releases]: https://github.com/ForNeVeR/tdlib.native/releases
[spec.linux]: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md
[spec.ubuntu-20.04]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md
[spec.ubuntu-22.04]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
[spec.macos-11]: https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md
[spec.macos-14]: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
[spec.windows]: https://github.com/actions/runner-images/blob/main/images/win/Windows2019-Readme.md
Expand Down
Loading

0 comments on commit 5fcae1d

Please sign in to comment.