From 913fd3330e50be338100a3a2efe0460ac3fe1b0d Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sun, 14 Jul 2024 21:46:56 +0200 Subject: [PATCH] CI: remove prebuilt toolchains --- .github/workflows/ficus.yml | 95 ++++++++++++++++++++++++++++++++++--- .github/workflows/unit.yml | 7 ++- ficus-toolchain/buildenv.sh | 10 +--- 3 files changed, 93 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ficus.yml b/.github/workflows/ficus.yml index fffce2334..9c8b67e20 100644 --- a/.github/workflows/ficus.yml +++ b/.github/workflows/ficus.yml @@ -2,13 +2,12 @@ name: Ficus build on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: BUILD_TYPE: Debug - BUILD_PARALLEL: 3 jobs: build-ficus-toolchain: @@ -24,12 +23,94 @@ jobs: - name: Install dependencies run: sudo apt-get update && sudo apt-get install -y cmake build-essential pax gcc g++ nasm bison bzip2 flex mtools texinfo libgmp-dev libmpfr-dev libmpc-dev xorriso - - name: Unpack prebuilt toolchain - run: cd ${{github.workspace}} && tar xf toolchain_scripts/toolchain-s1-linux-aarch64.tar.xz + - name: Cache generic toolchain + id: cache-toolchain + uses: actions/cache/restore@v4 + env: + cache-name: cache-toolchain + with: + path: | + toolchain/gcc-i686-elf-prefix + toolchain/gcc-x86_64-elf-prefix + toolchain/grub + toolchain/limine + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('toolchain_scripts/*') }} - - name: Build ficus toolchain + - if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }} + name: Build generic toolchain + run: source env.sh && toolchain_scripts/build-all.sh + + - if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }} + name: Strip toolchain + continue-on-error: true + run: find toolchain -type f | xargs strip + + - name: Save generic toolchain + id: cache-toolchain-save + uses: actions/cache/save@v4 + env: + cache-name: cache-toolchain + with: + path: | + toolchain/gcc-i686-elf-prefix + toolchain/gcc-x86_64-elf-prefix + toolchain/grub + toolchain/limine + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('toolchain_scripts/*') }} + + - name: Cache s1 toolchain + id: cache-toolchain-s1 + uses: actions/cache/restore@v4 + env: + cache-name: cache-toolchain-s1 + with: + path: | + toolchain/gcc-x86_64-ficus-prefix + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }} + + - if: ${{ steps.cache-toolchain-s1.outputs.cache-hit != 'true' }} + name: Build ficus toolchain s1 + run: source ${{github.workspace}}/env.sh && ${{github.workspace}}/ficus-toolchain/build-all.sh s1only + + - if: ${{ steps.cache-toolchain-s1.outputs.cache-hit != 'true' }} + name: Strip toolchain + continue-on-error: true + run: find toolchain -type f | xargs strip + + - name: Save s1 toolchain + id: cache-toolchain-s1-save + uses: actions/cache/save@v4 + env: + cache-name: cache-toolchain-s1 + with: + path: | + toolchain/gcc-x86_64-ficus-prefix + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }} + + - name: Cache s2 toolchain + id: cache-toolchain-s2 + uses: actions/cache/restore@v4 + env: + cache-name: cache-toolchain-s2 + with: + path: | + toolchain/gcc-x86_64-ficus-prefix + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}-${{ hashFiles('ficus-toolchain/newlib/**/*') }} + + - if: ${{ steps.cache-toolchain-s2.outputs.cache-hit != 'true' }} + name: Build ficus toolchain s2 run: source ${{github.workspace}}/env.sh && ${{github.workspace}}/ficus-toolchain/build-all.sh s2only + - name: Save s2 toolchain + id: cache-toolchain-s2-save + uses: actions/cache/save@v4 + env: + cache-name: cache-toolchain-s2 + with: + path: | + toolchain/gcc-x86_64-ficus-prefix + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}-${{ hashFiles('ficus-toolchain/newlib/**/*') }} + - name: Tar the toolchain run: cd ${{github.workspace}} && tar -czvf toolchain-ficus.tar.xz toolchain sysroot @@ -71,7 +152,7 @@ jobs: - name: Build iso # Build your program with the given configuration - run: source ${{github.workspace}}/env.sh && cmake --build ${{github.workspace}}/build --target iso --config ${{env.BUILD_TYPE}} --parallel ${{env.BUILD_PARALLEL}} + run: source ${{github.workspace}}/env.sh && cmake --build ${{github.workspace}}/build --target iso --config ${{env.BUILD_TYPE}} --parallel $(nproc) - name: Upload isos uses: actions/upload-artifact@v3 diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index eac266074..690a6f505 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -2,15 +2,14 @@ name: Unit tests on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Debug TEST_MODE: UNIT - BUILD_PARALLEL: 3 jobs: build: @@ -35,7 +34,7 @@ jobs: - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel ${{env.BUILD_PARALLEL}} + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc) - name: Test # Execute tests defined by the CMake configuration. diff --git a/ficus-toolchain/buildenv.sh b/ficus-toolchain/buildenv.sh index f88c98e1b..b43787f2d 100755 --- a/ficus-toolchain/buildenv.sh +++ b/ficus-toolchain/buildenv.sh @@ -1,19 +1,13 @@ #!/bin/bash if [ -z "$FICUS_ROOT" ]; then - echo "$FICUS_ROOT" is blank + echo "$FICUS_ROOT" is blank fi export PREFIX="$FICUS_ROOT/toolchain/gcc-x86_64-ficus-prefix/" export TARGET=x86_64-ficus export PATH="$PREFIX/bin:$PATH" -if [ -z "${BUILD_PARALLEL}" ] -then +if [ -z "${BUILD_PARALLEL}" ]; then export BUILD_PARALLEL=$(nproc) fi - -if [ -z "${BUILD_PARALLEL}" ] -then - export BUILD_PARALLEL=$BUILD_PARALLEL -fi