CI: handle artifact download and release properly #243
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 ../gcc-version | |
./bin/aarch64-elf-ld.lld -v 2>&1 | tee ../lld-arm64-version | |
bash "$script_dir/strip-binaries.sh" | |
cd ../ && cat lld-arm64-version >> gcc-version | |
- name: Create tarball | |
run: | | |
tar -cvf eva-gcc-arm64-$(/bin/date -u '+%d%m%Y%I%M').xz gcc-arm64/* | |
- uses: actions/upload-artifact@main | |
with: | |
name: aarch64-tarball | |
path: | | |
*.xz | |
gcc-version | |
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) | |
bash "$script_dir/strip-binaries.sh" | |
- name: Create tarball | |
run: | | |
tar -cvf eva-gcc-arm-$(/bin/date -u '+%d%m%Y%I%M').xz gcc-arm/* | |
- uses: actions/upload-artifact@main | |
with: | |
name: arm-tarball | |
path: | | |
*.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: | |
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 }} -F aarch64-tarball/gcc-version *.xz | |
send-day: | |
needs: [publish-release] | |
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!" | |
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 $(date +'%j' | awk '{print int($0 / 365 * 100)}')% complete. Time is flying." | |