Merge pull request #121 from shadow3aaa/dependabot/cargo/flexi_logger… #723
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
# Copyright 2023-2024, shadow3 (@shadow3aaa) | |
# | |
# This file is part of fas-rs. | |
# | |
# fas-rs is free software: you can redistribute it and/or modify it under | |
# the terms of the GNU General Public License as published by the Free | |
# Software Foundation, either version 3 of the License, or (at your option) | |
# any later version. | |
# | |
# fas-rs is distributed in the hope that it will be useful, but WITHOUT ANY | |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
# details. | |
# | |
# You should have received a copy of the GNU General Public License along | |
# with fas-rs. If not, see <https://www.gnu.org/licenses/>. | |
name: ci-build | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup ndk | |
run: | | |
ndk_url=$(wget -qO- https://github.com/android/ndk/releases/latest | grep -e 'https://dl.google.com/android/repository/android-ndk-.*-linux.zip' | sed -n 's/.*<a href="\([^"]*\)".*/\1/p') | |
wget -O ndk.zip $ndk_url -nv | |
mkdir ~/ndk_temp | |
unzip ndk.zip -d ~/ndk_temp 2>&1 > /dev/null | |
mv ~/ndk_temp/*/* ~/ndk_temp | |
- name: Setup rust toolchains | |
run: | | |
rustup default nightly | |
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android | |
rustup component add rust-src | |
rustup update | |
- name: Install cargo ndk | |
run: cargo install cargo-ndk | |
- name: Other deps | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib | |
- name: Build | |
run: | | |
export ANDROID_NDK_HOME=$(realpath ~/ndk_temp) | |
export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME | |
python3 ./make.py build --release --nightly | |
- name: Prepare artifacts | |
run: | | |
mkdir -p output/artifact/release | |
unzip "output/fas-rs_release_*.zip" -d output/artifact/release | |
- name: Upload release version | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fas-rs(release) | |
compression-level: 9 | |
path: output/artifact/release | |
debug-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup ndk | |
run: | | |
ndk_url=$(wget -qO- https://github.com/android/ndk/releases/latest | grep -e 'https://dl.google.com/android/repository/android-ndk-.*-linux.zip' | sed -n 's/.*<a href="\([^"]*\)".*/\1/p') | |
wget -O ndk.zip $ndk_url -nv | |
mkdir ~/ndk_temp | |
unzip ndk.zip -d ~/ndk_temp 2>&1 > /dev/null | |
mv ~/ndk_temp/*/* ~/ndk_temp | |
- name: Setup rust toolchains | |
run: | | |
rustup default nightly | |
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android | |
rustup component add rust-src | |
rustup update | |
- name: Install cargo ndk | |
run: cargo install cargo-ndk | |
- name: Other deps | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib | |
- name: Build | |
run: | | |
export ANDROID_NDK_HOME=$(realpath ~/ndk_temp) | |
export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME | |
python3 ./make.py build --debug --nightly | |
- name: Prepare artifacts | |
run: | | |
mkdir -p output/artifact/debug | |
unzip "output/fas-rs_debug_*.zip" -d output/artifact/debug | |
- name: Upload debug version | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fas-rs(debug) | |
compression-level: 9 | |
path: output/artifact/debug | |
push_to_ci_group: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
name: Push to CI Group | |
needs: | |
- debug-build | |
- release-build | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Package Artifacts | |
run: | | |
cd "${{ github.workspace }}/artifacts/fas-rs(debug)" | |
zip -9 -rq "../fas-rs(debug)" . | |
cd "${{ github.workspace }}/artifacts/fas-rs(release)" | |
zip -9 -rq "../fas-rs(release)" . | |
- name: Post to Debug Group | |
shell: bash | |
env: | |
GROUP_DEBUG_ID: ${{ secrets.TELEGRAM_TO }} | |
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
THREAD_ID: ${{ secrets.THREAD_ID }} | |
COMMIT_MESSAGE: |+ | |
New push to GitHub | |
``` | |
${{ github.event.head_commit.message }} | |
```by `${{ github.event.head_commit.author.name }}` | |
See commit detail [here](${{ github.event.head_commit.url }}) | |
run: | | |
ESCAPED=$(python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))') | |
cd ${{ github.workspace }} | |
echo $COMMIT_MESSAGE_FIXED | |
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${GROUP_DEBUG_ID}&message_thread_id=${THREAD_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug_zip%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:\"\"%7D,%7B%22type%22:%22document%22,%20%22media%22:%22attach://release_zip%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F debug_zip="@artifacts/fas-rs(debug).zip" -F release_zip="@artifacts/fas-rs(release).zip" |