mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-28 16:17:51 +01:00
183 lines
6.3 KiB
YAML
183 lines
6.3 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: 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
|
|
echo "/usr/local/opt/ccache/libexec" >> $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
|
|
with:
|
|
path: |
|
|
toolchain/gcc-x86_64-ficus-prefix
|
|
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
|
|
with:
|
|
path: |
|
|
toolchain/gcc-x86_64-ficus-prefix
|
|
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
|