Files
ficus/.github/workflows/ficus.yml
Stepan Usatiuk 1f2f4ba774
Some checks failed
Ficus build / iso (push) Has been cancelled
Ficus build / build-ficus-toolchain (push) Has been cancelled
Unit tests / build (push) Has been cancelled
CI: create ccache dir
maybe this is why it isn't working?
2024-07-15 19:41:56 +02:00

186 lines
6.4 KiB
YAML

name: Ficus build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Debug
jobs:
build-ficus-toolchain:
runs-on: ubuntu-latest
env:
CCACHE_DIR: ~/ccache-cache
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install sudo for ACT runner
run: apt-get update && apt-get install -y sudo
if: env.ACT=='true'
- 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 ccache
- name: Create ccache dir
run: mkdir ~/ccache-cache
- name: CCache cache
id: cache-ccache
uses: actions/cache@v4
with:
path: ~/ccache-cache
key: ${{ runner.os }}-ccache
- name: Add ccache to path
run: echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: Print ccache info
run: |
ccache -p
which gcc
which g++
- 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/*') }}
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
name: Build generic toolchain
run: source env.sh && toolchain_scripts/build-all.sh && ccache -s
- 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 && ccache -s
- 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-v2
with:
path: |
toolchain/gcc-x86_64-ficus-prefix
sysroot
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}-${{ hashFiles('ficus-toolchain/newlib/newlib-4.4.0.20231231/**') }}
- 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 && ccache -s
- name: Save s2 toolchain
id: cache-toolchain-s2-save
uses: actions/cache/save@v4
env:
cache-name: cache-toolchain-s2-v2
with:
path: |
toolchain/gcc-x86_64-ficus-prefix
sysroot
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}-${{ hashFiles('ficus-toolchain/newlib/newlib-4.4.0.20231231/**') }}
- name: Tar the toolchain
run: cd ${{github.workspace}} && tar -czvf toolchain-ficus.tar.xz toolchain sysroot
- name: Upload ficus toolchain
uses: actions/upload-artifact@v3
with:
name: toolchain-ficus
path: ${{github.workspace}}/toolchain-ficus.tar.xz
retention-days: 5
iso:
needs: build-ficus-toolchain
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install sudo for ACT runner
run: apt-get update && apt-get install -y sudo
if: env.ACT=='true'
- 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: Download toolchain
uses: actions/download-artifact@v3
with:
name: toolchain-ficus
path: ${{github.workspace}}
- name: Untar the toolchain
run: cd ${{github.workspace}} && tar xf toolchain-ficus.tar.xz
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: source ${{github.workspace}}/env.sh && cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DFICUS_ROOT=${{github.workspace}} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/CMake-x86_64-ficus-toolchain.cmake
- 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 $(nproc)
- name: Upload isos
uses: actions/upload-artifact@v3
with:
name: iso
path: ${{github.workspace}}/build/**/*.iso
retention-days: 5