-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update CI workflows and Dockerfile for improved compatibili…
…ty and structure
- Loading branch information
Showing
5 changed files
with
209 additions
and
89 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build Telegram Bot API Server on macOS | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Homebrew | ||
run: | | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
brew install gperf cmake openssl | ||
- name: Install dependencies | ||
run: | | ||
brew install gperf cmake openssl | ||
- name: Clone Telegram Bot API repository | ||
run: git clone --recursive https://github.com/tdlib/telegram-bot-api.git | ||
|
||
- name: Build Telegram Bot API | ||
run: | | ||
cd telegram-bot-api | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. | ||
cmake --build . --target install | ||
- name: Verify build | ||
run: | | ||
ls -l /usr/local/bin/telegram-bot-api* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build Telegram Bot API Server on Ubuntu 22 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get upgrade -y | ||
sudo apt-get install -y make git zlib1g-dev libssl-dev gperf cmake clang | ||
- name: Clone Telegram Bot API repository | ||
run: git clone --recursive https://github.com/tdlib/telegram-bot-api.git | ||
|
||
- name: Build Telegram Bot API | ||
run: | | ||
cd telegram-bot-api | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. | ||
cmake --build . --target install | ||
- name: Verify build | ||
run: | | ||
ls -l /usr/local/bin/telegram-bot-api* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build Telegram Bot API Server on Windows | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Visual Studio | ||
run: | | ||
choco install visualstudio2019community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64" | ||
choco install cmake | ||
- name: Install dependencies | ||
run: | | ||
choco install git | ||
choco install cmake | ||
choco install openssl | ||
- name: Clone Telegram Bot API repository | ||
run: git clone --recursive https://github.com/tdlib/telegram-bot-api.git | ||
|
||
- name: Build Telegram Bot API | ||
run: | | ||
cd telegram-bot-api | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=C:\telegram-bot-api .. | ||
cmake --build . --target install | ||
- name: Verify build | ||
run: | | ||
dir C:\telegram-bot-api\bin\telegram-bot-api* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,96 @@ | ||
name: Build and Release Telegram Bot API | ||
# name: Build and Release Telegram Bot API | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
# on: | ||
# push: | ||
# tags: | ||
# - "v*" | ||
|
||
env: | ||
BIN_PATH: /tmp/bin | ||
# env: | ||
# BIN_PATH: /tmp/bin | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, ubuntu-22.04, macos-latest, windows-latest] | ||
arch: [amd64, arm64] | ||
# strategy: | ||
# matrix: | ||
# os: [ubuntu-latest, ubuntu-22.04, macos-latest, windows-latest] | ||
# arch: [amd64, arm64] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
|
||
- name: Set up dependencies | ||
run: sudo apt-get update;sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake clang-14 libc++-14-dev libc++abi-14-dev | ||
# - name: Set up dependencies | ||
# run: sudo apt-get update;sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake clang-14 libc++-14-dev libc++abi-14-dev | ||
|
||
- name: Remove old telegram-bot-api | ||
run: rm -rf telegram-bot-api | ||
# - name: Remove old telegram-bot-api | ||
# run: rm -rf telegram-bot-api | ||
|
||
- name: Clone telegram-bot-api repository | ||
run: git clone --recursive https://github.com/tdlib/telegram-bot-api.git | ||
# - name: Clone telegram-bot-api repository | ||
# run: git clone --recursive https://github.com/tdlib/telegram-bot-api.git | ||
|
||
- name: Build telegram-bot-api binary | ||
env: | ||
GOARCH: ${{ matrix.arch }} | ||
GOOS: ${{ env.GOOS }} | ||
EXT: ${{ env.EXT }} | ||
run: | | ||
cd telegram-bot-api | ||
rm -rf build | ||
mkdir -p build | ||
cd build | ||
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. | ||
cmake --build . --target install | ||
cd ../.. | ||
# tar -czvf telegram-bot-api.tar.gz telegram-bot-api/bin/telegram-bot-api | ||
- name: Upload binaries | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: telegram-bot-api-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | ||
path: telegram-bot-api-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | ||
# - name: Build telegram-bot-api binary | ||
# env: | ||
# GOARCH: ${{ matrix.arch }} | ||
# GOOS: ${{ env.GOOS }} | ||
# EXT: ${{ env.EXT }} | ||
# run: | | ||
# cd telegram-bot-api | ||
# rm -rf build | ||
# mkdir -p build | ||
# cd build | ||
# CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. | ||
# cmake --build . --target install | ||
# cd ../.. | ||
# # tar -czvf telegram-bot-api.tar.gz telegram-bot-api/bin/telegram-bot-api | ||
# - name: Upload binaries | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: telegram-bot-api-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | ||
# path: telegram-bot-api-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | ||
|
||
release: | ||
name: Create GitHub Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create bin directory | ||
run: | | ||
mkdir -p ${{ env.BIN_PATH }} | ||
# release: | ||
# name: Create GitHub Release | ||
# needs: build | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Create bin directory | ||
# run: | | ||
# mkdir -p ${{ env.BIN_PATH }} | ||
|
||
- name: Download binaries | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ${{ env.BIN_PATH }} | ||
pattern: telegram-bot-api-* | ||
merge-multiple: true | ||
# - name: Download binaries | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# path: ${{ env.BIN_PATH }} | ||
# pattern: telegram-bot-api-* | ||
# merge-multiple: true | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R ${{ env.BIN_PATH }} | ||
# - name: Display structure of downloaded files | ||
# run: ls -R ${{ env.BIN_PATH }} | ||
|
||
- name: Release with assets | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: ${{ env.BIN_PATH }}/* | ||
# - name: Release with assets | ||
# uses: softprops/action-gh-release@v2 | ||
# with: | ||
# files: ${{ env.BIN_PATH }}/* | ||
|
||
# - name: Create Release | ||
# id: create_release | ||
# uses: actions/create-release@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: ${{ github.event.release.tag_name }} | ||
# release_name: Release ${{ github.event.release.tag_name }} | ||
# draft: false | ||
# prerelease: false | ||
# # - name: Create Release | ||
# # id: create_release | ||
# # uses: actions/create-release@v1 | ||
# # env: | ||
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# # with: | ||
# # tag_name: ${{ github.event.release.tag_name }} | ||
# # release_name: Release ${{ github.event.release.tag_name }} | ||
# # draft: false | ||
# # prerelease: false | ||
|
||
# - name: Upload Release Asset | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: ./telegram-bot-api.tar.gz | ||
# asset_name: telegram-bot-api.tar.gz | ||
# asset_content_type: application/gzip | ||
# # - name: Upload Release Asset | ||
# # uses: actions/upload-release-asset@v1 | ||
# # env: | ||
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# # with: | ||
# # upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# # asset_path: ./telegram-bot-api.tar.gz | ||
# # asset_name: telegram-bot-api.tar.gz | ||
# # asset_content_type: application/gzip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
FROM ubuntu:latest | ||
FROM ubuntu:22 | ||
|
||
WORKDIR /telegrambotapi | ||
|
||
RUN apt-get update \ | ||
&& apt-get -y upgrade \ | ||
&& apt-get -y install make git zlib1g-dev libssl-dev gperf cmake clang-14 libc++-dev libc++abi-dev \ | ||
&& apt-get -y install make git zlib1g-dev libssl-dev gperf cmake clang-14 libc++-14-dev libc++abi-14-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN git clone --recursive https://github.com/tdlib/telegram-bot-api.git \ | ||
&& cd telegram-bot-api \ | ||
&& rm -rf build \ | ||
&& mkdir build \ | ||
&& cd build \ | ||
&& CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. \ | ||
&& CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. \ | ||
&& cmake --build . --target install \ | ||
&& cd /telegrambotapi | ||
&& cd ../.. | ||
|
||
#COPY ./telegram-bot-api /telegrambotapi/telegram-bot-api | ||
RUN ls -l telegram-bot-api/bin/telegram-bot-api* | ||
|
||
#RUN chmod +x /telegram-bot-api | ||
|
||
#CMD ["telegram-bot-api", "" | ||
CMD ["/telegrambotapi/telegram-bot-api/bin/telegram-bot-api"] |