Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI for all OS
Browse files Browse the repository at this point in the history
Andreal2000 committed May 26, 2024
1 parent 0fbfedd commit befda49
Showing 3 changed files with 161 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI Linux

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
API_HASH: a3406de8d171bb422bb6ddf3bbd800e2
API_ID: 94575

jobs:
ci:

strategy:
fail-fast: false
matrix:
feature: [default, download-tdlib, pkg-config, docs]

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download TDLib
if: matrix.feature == 'default' || matrix.feature == 'pkg-config'
run: |
gh release download test --pattern 'Linux*.zip'
unzip -q *.zip -d .
- name: Set pkg-config environment variables
if: matrix.feature == 'pkg-config'
run: echo "PKG_CONFIG_PATH=$(pwd)/tdlib/lib/pkgconfig" >> $GITHUB_ENV
- name: Set default environment variables
if: matrix.feature == 'default'
run: echo "LOCAL_TDLIB_PATH=$(pwd)/tdlib/" >> $GITHUB_ENV
- name: Run cargo build
run: cargo build --verbose --features ${{ matrix.feature }}
- name: Run cargo test
run: cargo test --verbose -- --nocapture --test-threads=1
- name: Run cargo clippy
run: cargo clippy --features ${{ matrix.feature }} -- -D warnings
- name: Run cargo fmt
run: cargo fmt --all -- --check
49 changes: 49 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI macOS

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
API_HASH: a3406de8d171bb422bb6ddf3bbd800e2
API_ID: 94575

jobs:
ci:

strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14]
feature: [default, download-tdlib, pkg-config, docs]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download TDLib
if: matrix.feature == 'default' || matrix.feature == 'pkg-config'
run: |
gh release download test --pattern ${{ runner.arch == 'ARM64' && 'macOS-ARM64*.zip' || 'macOS-X64*.zip' }}
unzip -q *.zip -d .
- name: Set pkg-config environment variables
if: matrix.feature == 'pkg-config'
run: |
echo "PKG_CONFIG_PATH=$(pwd)/tdlib/lib/pkgconfig" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$(pwd)/tdlib/lib" >> $GITHUB_ENV
- name: Set default environment variables
if: matrix.feature == 'default'
run: echo "LOCAL_TDLIB_PATH=$(pwd)/tdlib/" >> $GITHUB_ENV
- name: Run cargo build
run: cargo build --verbose --features ${{ matrix.feature }}
- name: Run cargo test
run: cargo test --verbose -- --nocapture --test-threads=1
- name: Run cargo clippy
run: cargo clippy --features ${{ matrix.feature }} -- -D warnings
- name: Run cargo fmt
run: cargo fmt --all -- --check
66 changes: 66 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI Windows

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
API_HASH: a3406de8d171bb422bb6ddf3bbd800e2
API_ID: 94575

jobs:
ci:

strategy:
fail-fast: false
matrix:
feature: [default, download-tdlib, pkg-config, docs]

runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download TDLib
if: matrix.feature == 'default' || matrix.feature == 'pkg-config'
run: |
gh release download test --pattern 'Windows*.zip'
unzip -q *.zip -d .
shell: bash
- name: Install pkg-config
if: matrix.feature == 'pkg-config'
run: |
mkdir pkg-config
cd pkg-config
curl -kLSsO http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip
curl -kLSsO http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip
curl -kLSsO http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
unzip -q pkg-config_0.26-1_win32.zip -d pkg-config_0.26-1_win32
unzip -q glib_2.28.8-1_win32.zip -d glib_2.28.8-1_win32
unzip -q gettext-runtime_0.18.1.1-2_win32.zip -d gettext-runtime_0.18.1.1-2_win32
cp ./gettext-runtime_0.18.1.1-2_win32/bin/intl.dll ./pkg-config_0.26-1_win32/bin/
cp ./glib_2.28.8-1_win32/bin/* ./pkg-config_0.26-1_win32/bin/
shell: bash
- name: Set pkg-config environment variables
if: matrix.feature == 'pkg-config'
run: |
echo "$((Get-Item .).FullName)\pkg-config\pkg-config_0.26-1_win32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "PKG_CONFIG_PATH=$((Get-Item .).FullName)\tdlib\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$((Get-Item .).FullName)\tdlib\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Set default environment variables
if: matrix.feature == 'default'
run: echo "LOCAL_TDLIB_PATH=$((Get-Item .).FullName)\tdlib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Run cargo build
run: cargo build --verbose --features ${{ matrix.feature }}
- name: Run cargo test
run: cargo test --verbose -- --nocapture --test-threads=1
- name: Run cargo clippy
run: cargo clippy --features ${{ matrix.feature }} -- -D warnings
- name: Run cargo fmt
run: cargo fmt --all -- --check

0 comments on commit befda49

Please sign in to comment.