CI: fix telegram message push #235
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: GCC+LLD Build | |
on: | |
push: | |
schedule: | |
- cron: '0 0 * * 0,4' | |
env: | |
GITHUB_EMAIL: ${{ secrets.EMAIL }} | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} | |
GITHUB_USER: ${{ secrets.USERNAME }} | |
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
CHAT_ID: ${{ secrets.CHAT }} | |
jobs: | |
build-arm64-tc: | |
runs-on: ubuntu-latest | |
container: | |
image: fedora:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set build date | |
id: get-date | |
run: | | |
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime | |
echo ::set-output name=date::$(/bin/date -u "+%Y%m%d") | |
- name: Setup | |
run: | | |
sudo dnf groupinstall "Development tools" -y | |
sudo dnf install mpfr-devel gmp-devel libmpc-devel zlib-devel glibc-devel.i686 glibc-devel binutils-devel g++ texinfo bison flex cmake which ninja-build clang lld bzip2 binutils-arm-linux-gnu binutils-aarch64-linux-gnu -y | |
- name: Build | |
run: | | |
chmod a+x build-*.sh | |
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d "disable_web_page_preview=true" -d "parse_mode=html" -d text="<b>Starting ARM64 GCC Build</b>" | |
./build-gcc.sh -a arm64 | |
./build-lld.sh -a arm64 | |
script_dir=$(pwd) | |
cd gcc-arm64 | |
./bin/aarch64-elf-gcc -v 2>&1 | tee /tmp/gcc-version | |
./bin/aarch64-elf-ld.lld -v 2>&1 | tee /tmp/lld-arm64-version | |
bash "$script_dir/strip-binaries.sh" | |
- name: Create tarball | |
run: | | |
tar -cf eva-gcc-arm64-$(/bin/date -u '+%d%m%Y%I%M').xz * | |
- uses: actions/upload-artifact@main | |
with: | |
name: arm64-tar | |
path: | | |
gcc-arm64/*.xz | |
build-arm-tc: | |
runs-on: ubuntu-latest | |
container: | |
image: fedora:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set build date | |
id: get-date | |
run: | | |
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime | |
echo ::set-output name=date::$(/bin/date -u "+%Y%m%d") | |
- name: Setup | |
run: | | |
sudo dnf groupinstall "Development tools" -y | |
sudo dnf install mpfr-devel gmp-devel libmpc-devel zlib-devel glibc-devel.i686 glibc-devel binutils-devel g++ texinfo bison flex cmake which ninja-build clang lld bzip2 -y | |
- name: Build | |
run: | | |
chmod a+x build-*.sh | |
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d "disable_web_page_preview=true" -d "parse_mode=html" -d text="<b>Starting ARM (32-bit) GCC Build</b>" | |
./build-gcc.sh -a arm | |
./build-lld.sh -a arm | |
script_dir=$(pwd) | |
cd gcc-arm | |
./bin/arm-eabi-gcc -v 2>&1 | tee /tmp/gcc-arm-version | |
./bin/arm-eabi-ld.lld -v 2>&1 | tee /tmp/lld-arm-version | |
bash "$script_dir/strip-binaries.sh" | |
- name: Create tarball | |
run: | | |
tar -cf eva-gcc-arm-$(/bin/date -u '+%d%m%Y%I%M').xz * | |
- uses: actions/upload-artifact@main | |
with: | |
name: arm-tar | |
path: | | |
gcc-arm/*.xz | |
publish-release: | |
needs: [build-arm64-tc,build-arm-tc] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restoring artifacts | |
uses: actions/download-artifact@main | |
with: | |
name: release-zip | |
path: ${{ github.workspace }} | |
- name: Release Tag | |
id: release_tag | |
run: echo "TAG_NAME='GCC Build $(date -u +%d%m%Y%I%M)'" >> $GITHUB_ENV | |
- name: Create Release | |
run: gh release create ${{ env.TAG_NAME }} --generate-notes -p *.zip | |
send-day: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send telegram messages | |
run: | | |
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d "disable_web_page_preview=true" -d "parse_mode=html" -d text="It's $(date +%A) my dudes!" | |
export percentage=$(date +'%j' | awk '{print int($0 / 365 * 100)}') && curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d "disable_web_page_preview=true" -d "parse_mode=html" -d text="The year is $(percentage)% complete. Time is flying." | |