diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 3fd6d465..b41b7818 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -7,6 +7,31 @@ on: branches: [ master ] jobs: + deploydoc: + name: Deploy Documentation to GitHub Pages + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Doxygen + run: | + sudo apt update + sudo apt --no-install-recommends -y install doxygen make + + - name: Generate Documentation + run: make doxygen + + - name: Copy GitHub Pages Website + run: cp -r tools/website/* doxygen-doc/ + + - name: Deploy documentation + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: doxygen-doc + buildcompiler: name: Build Cross-Compiler & Toolchain runs-on: ubuntu-latest @@ -22,53 +47,13 @@ jobs: path: tools/cross key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }} - - name: Update System + - name: Run make ci-setup in dev container if: steps.cache-cross.outputs.cache-hit != 'true' - run: sudo apt update - - - name: Install GCC Dependencies - if: steps.cache-cross.outputs.cache-hit != 'true' - run: sudo apt --no-install-recommends -y install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libzstd-dev libisl-dev m4 automake gettext gperf dejagnu guile-3.0 guile-3.0-dev expect tcl autogen tex-common sphinx-common git ssh diffutils patch autoconf2.69 libtool wget dpkg - - - name: Check autoconf - if: steps.cache-cross.outputs.cache-hit != 'true' - run: | - if [ "$(autoconf --version | head -n 1 | awk '{print $NF}')" != "2.69" ]; then - echo "Autoconf version is not 2.69, performing additional steps..." - wget https://launchpad.net/ubuntu/+archive/primary/+files/autoconf_2.69-11.1_all.deb - sudo dpkg --force-all -i ./autoconf_2.69-11.1_all.deb - fi - - - name: Check automake - if: steps.cache-cross.outputs.cache-hit != 'true' - run: | - if [ "$(automake --version | head -n 1 | awk '{print $NF}')" != "1.15.1" ]; then - echo "Automake version is not 1.15.1, performing additional steps..." - wget https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz - tar -xzf automake-1.15.1.tar.gz - cd automake-1.15.1 - ./configure - make - sudo make install - fi - - - name: Clone All - if: steps.cache-cross.outputs.cache-hit != 'true' - run: make --quiet -C tools __clone_all_no_qemu - - - name: Compile Binutils - if: steps.cache-cross.outputs.cache-hit != 'true' - run: make --quiet -C tools do_binutils - - - name: Compile GCC - if: steps.cache-cross.outputs.cache-hit != 'true' - run: make --quiet -C tools do_gcc - - - name: Clean Up - if: steps.cache-cross.outputs.cache-hit != 'true' - run: | - cd tools - rm -rf binutils-gdb gcc + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + /usr/bin/make ci-setup analyze: name: Analyze (${{ matrix.language }}) @@ -145,34 +130,8 @@ jobs: with: category: "/language:${{matrix.language}}" - deploydoc: - name: Deploy Documentation to GitHub Pages - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Update System - run: sudo apt update - - - name: Install Doxygen - run: sudo apt --no-install-recommends -y install doxygen make - - - name: Generate Documentation - run: make doxygen - - - name: Copy GitHub Pages Website - run: cp -r tools/website/* doxygen-doc/ - - - name: Deploy documentation - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: doxygen-doc - - compile_amd64: - name: Build amd64 + compile: + name: Build OS runs-on: ubuntu-latest needs: [buildcompiler] steps: @@ -180,13 +139,6 @@ jobs: with: submodules: recursive - - name: Update & Install Required Packages - run: | - sudo apt update - sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 - make --quiet -C tools do_limine - make --quiet prepare - - name: Cache cross Folder id: cache-cross uses: actions/cache@v4 @@ -194,167 +146,13 @@ jobs: path: tools/cross key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }} - - name: Configure config.mk - run: sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH + - name: Run make ci-build in dev container + uses: devcontainers/ci@v0.3 + with: + runCmd: /usr/bin/make ci-build - - name: Compile Debug and Release ISO - run: | - make build - mv Fennix.iso Fennix-debug.iso - make clean - sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG - make build - mv Fennix.iso Fennix-release.iso - - - name: Upload Artifact (Fennix-debug.iso) + - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: Fennix-amd64-debug - path: Fennix-debug.iso - - - name: Upload Artifact (Fennix-release.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-amd64-release - path: Fennix-release.iso - - compile_i386: - name: Build i386 - runs-on: ubuntu-latest - needs: [buildcompiler] - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Update & Install Required Packages - run: | - sudo apt update - sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 - make --quiet -C tools do_limine - make --quiet prepare - - - name: Cache cross Folder - id: cache-cross - uses: actions/cache@v4 - with: - path: tools/cross - key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }} - - - name: Configure config.mk - run: sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH - - - name: Compile Debug and Release ISO - run: | - make build - mv Fennix.iso Fennix-debug.iso - make clean - sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG - make build - mv Fennix.iso Fennix-release.iso - - - name: Upload Artifact (Fennix-debug.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-i386-debug - path: Fennix-debug.iso - - - name: Upload Artifact (Fennix-release.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-i386-release - path: Fennix-release.iso - - compile_aarch64: - name: Build aarch64 - runs-on: ubuntu-latest - needs: [buildcompiler] - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Update & Install Required Packages - run: | - sudo apt update - sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 - make --quiet -C tools do_limine - make --quiet prepare - - - name: Cache cross Folder - id: cache-cross - uses: actions/cache@v4 - with: - path: tools/cross - key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }} - - - name: Configure config.mk - run: sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./config.mk && cat config.mk | grep OSARCH - - - name: Compile Debug and Release ISO - run: | - make build - mv Fennix.iso Fennix-debug.iso - make clean - sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG - make build - mv Fennix.iso Fennix-release.iso - - - name: Upload Artifact (Fennix-debug.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-aarch64-debug - path: Fennix-debug.iso - - - name: Upload Artifact (Fennix-release.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-aarch64-release - path: Fennix-release.iso - - compile_arm: - name: Build arm - runs-on: ubuntu-latest - needs: [buildcompiler] - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Update & Install Required Packages - run: | - sudo apt update - sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 - make --quiet -C tools do_limine - make --quiet prepare - - - name: Cache cross Folder - id: cache-cross - uses: actions/cache@v4 - with: - path: tools/cross - key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }} - - - name: Configure config.mk - run: sed -i 's/.*OSARCH = .*/OSARCH = arm/' ./config.mk && cat config.mk | grep OSARCH - - - name: Compile Debug and Release ISO - run: | - make build - mv Fennix.iso Fennix-debug.iso - make clean - sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG - make build - mv Fennix.iso Fennix-release.iso - - - name: Upload Artifact (Fennix-debug.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-arm-debug - path: Fennix-debug.iso - - - name: Upload Artifact (Fennix-release.iso) - uses: actions/upload-artifact@v4 - with: - name: Fennix-arm-release - path: Fennix-release.iso + name: Fennix + path: artifacts/ diff --git a/.gitignore b/.gitignore index 838e241f..5765cff0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ iso_tmp_data +artifacts initrd_tmp_data initrd/usr/include/* !initrd/usr/include/.gitkeep diff --git a/Makefile b/Makefile index b8a89a8a..68dae8d4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include config.mk -.PHONY: default tools clean +.PHONY: default tools clean ci-build # First rule default: @@ -99,13 +99,13 @@ endif # Install necessary packages, build cross-compiler etc... tools: - make --quiet -C tools all + $(MAKE) --quiet -C tools all prepare: - make --quiet -C Kernel prepare - make --quiet -C Bootloader prepare - make --quiet -C Drivers prepare - make --quiet -C Userspace prepare + $(MAKE) --quiet -C Kernel prepare + $(MAKE) --quiet -C Bootloader prepare + $(MAKE) --quiet -C Drivers prepare + $(MAKE) --quiet -C Userspace prepare setup: $(MAKE) prepare @@ -114,32 +114,88 @@ setup: build: build_kernel build_bootloader build_userspace build_drivers build_image dump: - make --quiet -C Kernel dump + $(MAKE) --quiet -C Kernel dump rebuild: clean build +__ci-build-set-release: + sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG + +__ci-build-set-debug: + sed -i 's/.*DEBUG = .*/DEBUG = 1/' ./config.mk && cat config.mk | grep DEBUG + +ci-setup: + $(MAKE) --quiet -C tools ci + +ci-build: +# amd64 + sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH + $(MAKE) build + mv Fennix.iso Fennix-amd64-debug.iso + $(MAKE) clean + $(MAKE) __ci-build-set-release + $(MAKE) build + mv Fennix.iso Fennix-amd64-release.iso + $(MAKE) clean +# i386 + $(MAKE) __ci-build-set-debug + sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH + $(MAKE) build + mv Fennix.iso Fennix-i386-debug.iso + $(MAKE) clean + $(MAKE) __ci-build-set-release + $(MAKE) build + mv Fennix.iso Fennix-i386-release.iso + $(MAKE) clean +# ARM + $(MAKE) __ci-build-set-debug + sed -i 's/.*OSARCH = .*/OSARCH = arm/' ./config.mk && cat config.mk | grep OSARCH + $(MAKE) build + mv Fennix.iso Fennix-arm-debug.iso + $(MAKE) clean + $(MAKE) __ci-build-set-release + $(MAKE) build + mv Fennix.iso Fennix-arm-release.iso + $(MAKE) clean +# AArch64 + $(MAKE) __ci-build-set-debug + sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./config.mk && cat config.mk | grep OSARCH + $(MAKE) build + mv Fennix.iso Fennix-aarch64-debug.iso + $(MAKE) clean + $(MAKE) __ci-build-set-release + $(MAKE) build + mv Fennix.iso Fennix-aarch64-release.iso + $(MAKE) clean +# Restore original config + $(MAKE) __ci-build-set-debug + sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH +# Move all files to artifacts directory + mkdir -p artifacts + mv Fennix-*.iso artifacts/ + ifeq ($(QUIET_BUILD), 1) MAKE_QUIET_FLAG = --quiet endif build_kernel: ifeq ($(BUILD_KERNEL), 1) - make -j$(shell nproc) $(MAKE_QUIET_FLAG) -C Kernel build + $(MAKE) -j$(shell nproc) $(MAKE_QUIET_FLAG) -C Kernel build endif build_bootloader: ifeq ($(BUILD_BOOTLOADER), 1) - make $(MAKE_QUIET_FLAG) -C Bootloader build + $(MAKE) $(MAKE_QUIET_FLAG) -C Bootloader build endif build_drivers: ifeq ($(BUILD_DRIVERS), 1) - make $(MAKE_QUIET_FLAG) -C Drivers build + $(MAKE) $(MAKE_QUIET_FLAG) -C Drivers build endif build_userspace: ifeq ($(BUILD_USERSPACE), 1) - make $(MAKE_QUIET_FLAG) -C Userspace build + $(MAKE) $(MAKE_QUIET_FLAG) -C Userspace build endif build_image: @@ -262,7 +318,7 @@ run: build qemu clean: clean_logs rm -rf doxygen-doc iso_tmp_data initrd_tmp_data rm -f initrd.tar $(OSNAME).iso $(OSNAME).img - make -C Kernel clean - make -C Userspace clean - make -C Drivers clean - make -C Bootloader clean + $(MAKE) -C Kernel clean + $(MAKE) -C Userspace clean + $(MAKE) -C Drivers clean + $(MAKE) -C Bootloader clean diff --git a/tools/Makefile b/tools/Makefile index 25ec7709..d16075e4 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -14,6 +14,7 @@ default: $(error Please specify a target) all: do_tools do_limine __clone_qemu __clone_all_no_qemu do_binutils do_gcc do_qemu +ci: do_tools do_limine __clone_all_no_qemu do_binutils do_gcc clean: rm -f rep ep @@ -147,8 +148,8 @@ __do_binutils: --disable-tls \ --disable-pie \ && \ - make --quiet all -j$(shell nproc) && \ - make --quiet install + $(MAKE) --quiet all -j$(shell nproc) && \ + $(MAKE) --quiet install __do_gcc: mkdir -p $(GCC_CLONE_PATH)/__build @@ -166,10 +167,10 @@ __do_gcc: --disable-tls \ --disable-pie \ && \ - make --quiet all-gcc -j$(shell nproc) && \ - make --quiet all-target-libgcc -j$(shell nproc) && \ - make --quiet install-gcc -j$(shell nproc) && \ - make --quiet install-target-libgcc -j$(shell nproc) + $(MAKE) --quiet all-gcc -j$(shell nproc) && \ + $(MAKE) --quiet all-target-libgcc -j$(shell nproc) && \ + $(MAKE) --quiet install-gcc -j$(shell nproc) && \ + $(MAKE) --quiet install-target-libgcc -j$(shell nproc) do_binutils: $(MAKE) __do_binutils BUILD_TARGET="x86_64-fennix" @@ -196,5 +197,5 @@ do_qemu: --disable-vnc \ --disable-opengl \ && \ - make --quiet -j$(shell nproc) && \ - make --quiet install + $(MAKE) --quiet -j$(shell nproc) && \ + $(MAKE) --quiet install