From c5aa085a8aaa568c1370ca63ef2c27a6f80f3b6b Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Sat, 15 Mar 2025 09:19:14 +0100 Subject: [PATCH] CI: split up waterbox compile jobs into multiple workflows This allows finetuning the on: conditions for each workflow and gives a better base for future work where we might want more workflows or more separation between waterbox cores. Quicknes being in the waterbox workflow made no sense to begin with. I've also used the cache action to cache the waterbox build which should prevent unnecessary rebuilds and improve speed slightly. I'm not really happy with the way reusable workflows work as they require re-cloning the repository and re-fetching clang, but the alternative would be copy-pasting the waterbox build action everywhere as far as I can tell. --- .editorconfig | 3 + .github/workflows/make.yml | 161 --------------------------- .github/workflows/mame.yml | 59 ++++++++++ .github/workflows/quickernes.yml | 33 ++++++ .github/workflows/waterbox-cores.yml | 82 ++++++++++++++ .github/workflows/waterbox.yml | 61 ++++++++++ 6 files changed, 238 insertions(+), 161 deletions(-) delete mode 100644 .github/workflows/make.yml create mode 100644 .github/workflows/mame.yml create mode 100644 .github/workflows/quickernes.yml create mode 100644 .github/workflows/waterbox-cores.yml create mode 100644 .github/workflows/waterbox.yml diff --git a/.editorconfig b/.editorconfig index d4dac69bf6..f81a3d4d38 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,6 +3,9 @@ root = true [*] indent_style = tab +[*.yml] +indent_style = space + [*.cs] csharp_new_line_before_open_brace = all csharp_new_line_before_else = true diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml deleted file mode 100644 index bf4a7f7ed0..0000000000 --- a/.github/workflows/make.yml +++ /dev/null @@ -1,161 +0,0 @@ -name: Build Emulation Cores - -on: - pull_request: - branches: [ "master" ] - paths: [ "waterbox/**" ] - push: - branches: [ "master" ] - paths: [ "waterbox/**" ] - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - CC: clang-18 - -jobs: - - build-waterbox: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Installing clang 18 - run: wget https://apt.llvm.org/llvm.sh; - chmod u+x llvm.sh; - sudo ./llvm.sh 18; - clang-18 --version; - - name: Getting submodule(s) - working-directory: ./waterbox/ - run: git submodule update --init musl - - name: Building musl - working-directory: ./waterbox/musl - run: ./wbox_configure.sh; - ./wbox_build.sh; - - name: Building libcxx - working-directory: ./waterbox/libcxx - run: ./do-everything.sh - - name: Building nyma - working-directory: ./waterbox/nyma - run: ./build-and-install-zlib.sh - - name: Uploading compiled waterbox - uses: actions/upload-artifact@v4 - with: - name: compiled-waterbox - path: waterbox/sysroot - - build-waterboxed-cores: - runs-on: ubuntu-latest - needs: build-waterbox - steps: - - uses: actions/checkout@v4 - - name: Getting submodule(s) - working-directory: ./waterbox/ - run: git submodule update --init snes9x; - git submodule update --init melon/melonDS; - git submodule update --init nyma/mednafen; - git submodule update --init ares64/ares/thirdparty/angrylion-rdp; - git submodule update --init gpgx/Genesis-Plus-GX; - git submodule update --init ../submodules/sameboy/libsameboy; - git submodule update --init uae/libretro-uae; - git submodule update --init stella/core; - git submodule update --init dsda/core; - - name: Download compiled waterbox - uses: actions/download-artifact@v4 - with: - name: compiled-waterbox - path: waterbox/sysroot - - name: Installing clang 18 - run: wget https://apt.llvm.org/llvm.sh; - chmod u+x llvm.sh; - sudo ./llvm.sh 18; - clang-18 --version; - - name: Giving execution permission to compiler - working-directory: ./waterbox/sysroot - run: chmod u+x bin/* - - name: Building cores - working-directory: ./waterbox/ - run: ./make-all-cores.sh install - - name: Upload waterbox cores - uses: actions/upload-artifact@v4 - with: - name: waterbox-cores - path: | - Assets/dll/ares64_interpreter.wbx.zst - Assets/dll/ares64_recompiler.wbx.zst - Assets/dll/bsnes.wbx.zst - Assets/dll/dsda.wbx.zst - Assets/dll/faust.wbx.zst - Assets/dll/gpgx.wbx.zst - Assets/dll/hyper.wbx.zst - Assets/dll/libsnes.wbx.zst - Assets/dll/melonDS.wbx.zst - Assets/dll/ngp.wbx.zst - Assets/dll/pcfx.wbx.zst - Assets/dll/picodrive.wbx.zst - Assets/dll/shock.wbx.zst - Assets/dll/snes9x.wbx.zst - Assets/dll/ss.wbx.zst - Assets/dll/stella.wbx.zst - Assets/dll/tic80.wbx.zst - Assets/dll/turbo.wbx.zst - Assets/dll/uae.wbx.zst - Assets/dll/uzem.wbx.zst - Assets/dll/vb.wbx.zst - Assets/dll/virtualjaguar.wbx.zst - - build-mame: - runs-on: ubuntu-latest - needs: build-waterbox - steps: - - uses: actions/checkout@v4 - - name: Getting submodule(s) - working-directory: ./waterbox/ - run: git submodule update --init mame-arcade/mame - - name: Download compiled waterbox - uses: actions/download-artifact@v4 - with: - name: compiled-waterbox - path: waterbox/sysroot - - name: Installing clang 18 - run: wget https://apt.llvm.org/llvm.sh; - chmod u+x llvm.sh; - sudo ./llvm.sh 18; - clang-18 --version; - - name: Giving execution permission to compiler - working-directory: ./waterbox/sysroot - run: chmod u+x bin/* - - name: Build emulibc - working-directory: ./waterbox/emulibc - run: make -j4 - - name: Build libco - working-directory: ./waterbox/libco - run: make -j4 - - name: Building MAME - working-directory: ./waterbox/mame-arcade - run: make -j4 install - - name: Upload mame core - uses: actions/upload-artifact@v4 - with: - name: mame-core - path: | - Assets/dll/libmamearcade.wbx.zst - - build-quickernes: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Getting submodule(s) - working-directory: ./quicknes - run: git submodule update --recursive --init core - - name: Building QuickerNES core (Linux) - working-directory: ./quicknes/make - run: make -j4; make install - - name: Upload quicknes core - uses: actions/upload-artifact@v4 - with: - name: quicknes-core - path: | - Assets/dll/libquicknes.so diff --git a/.github/workflows/mame.yml b/.github/workflows/mame.yml new file mode 100644 index 0000000000..d60aab8862 --- /dev/null +++ b/.github/workflows/mame.yml @@ -0,0 +1,59 @@ +name: Build mame (waterbox) + +on: + pull_request: + branches: [ "master" ] + paths: [ "waterbox/emulibc/**", "waterbox/libco/**", "waterbox/libcxx/**", "waterbox/musl/**", "waterbox/*", "waterbox/mame-arcade/**" ] + push: + branches: [ "master" ] + paths: [ "waterbox/emulibc/**", "waterbox/libco/**", "waterbox/libcxx/**", "waterbox/musl/**", "waterbox/*", "waterbox/mame-arcade/**" ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CC: clang-18 + +jobs: + + build-waterbox: + uses: ./.github/workflows/waterbox.yml + + build-mame: + runs-on: ubuntu-latest + needs: build-waterbox + steps: + - uses: actions/checkout@v4 + - name: Getting submodule(s) + working-directory: ./waterbox/ + run: git submodule update --init mame-arcade/mame + - name: Install clang 18 + run: wget https://apt.llvm.org/llvm.sh; + chmod u+x llvm.sh; + sudo ./llvm.sh 18; + clang-18 --version; + - name: Download compiled waterbox + uses: actions/download-artifact@v4 + with: + name: compiled-waterbox + path: waterbox/sysroot + - name: Give execution permission to compiler + working-directory: ./waterbox/sysroot + run: chmod u+x bin/* + - name: Build emulibc + working-directory: ./waterbox/emulibc + run: make -j + - name: Build libco + working-directory: ./waterbox/libco + run: make -j + - name: Build MAME + working-directory: ./waterbox/mame-arcade + run: make -j4 install + - name: Upload mame core + uses: actions/upload-artifact@v4 + with: + name: mame-core + path: | + Assets/dll/libmamearcade.wbx.zst diff --git a/.github/workflows/quickernes.yml b/.github/workflows/quickernes.yml new file mode 100644 index 0000000000..bd0a966757 --- /dev/null +++ b/.github/workflows/quickernes.yml @@ -0,0 +1,33 @@ +name: Build quickerNES core + +on: + pull_request: + branches: [ "master" ] + paths: [ "quicknes/**" ] + push: + branches: [ "master" ] + paths: [ "quicknes/**" ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + build-quickernes: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Getting submodule(s) + working-directory: ./quicknes + run: git submodule update --recursive --init core + - name: Building QuickerNES core (Linux) + working-directory: ./quicknes/make + run: make -j4; make install + - name: Upload quicknes core + uses: actions/upload-artifact@v4 + with: + name: quicknes-core + path: | + Assets/dll/libquicknes.so diff --git a/.github/workflows/waterbox-cores.yml b/.github/workflows/waterbox-cores.yml new file mode 100644 index 0000000000..56e2d26964 --- /dev/null +++ b/.github/workflows/waterbox-cores.yml @@ -0,0 +1,82 @@ +name: Build Waterbox Cores + +on: + pull_request: + branches: [ "master" ] + paths: [ "waterbox/**" ] + push: + branches: [ "master" ] + paths: [ "waterbox/**" ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CC: clang-18 + +jobs: + + build-waterbox: + uses: ./.github/workflows/waterbox.yml + + build-waterboxed-cores: + runs-on: ubuntu-latest + needs: build-waterbox + steps: + - uses: actions/checkout@v4 + - name: Getting submodule(s) + working-directory: ./waterbox/ + run: git submodule update --init snes9x; + git submodule update --init melon/melonDS; + git submodule update --init nyma/mednafen; + git submodule update --init ares64/ares/thirdparty/angrylion-rdp; + git submodule update --init gpgx/Genesis-Plus-GX; + git submodule update --init ../submodules/sameboy/libsameboy; + git submodule update --init uae/libretro-uae; + git submodule update --init stella/core; + git submodule update --init dsda/core; + - name: Install clang 18 + run: wget https://apt.llvm.org/llvm.sh; + chmod u+x llvm.sh; + sudo ./llvm.sh 18; + clang-18 --version; + - name: Download compiled waterbox + uses: actions/download-artifact@v4 + with: + name: compiled-waterbox + path: waterbox/sysroot + - name: Give execution permission to compiler + working-directory: ./waterbox/sysroot + run: chmod u+x bin/* + - name: Build all waterbox cores + working-directory: ./waterbox/ + run: ./make-all-cores.sh install + - name: Upload waterbox cores + uses: actions/upload-artifact@v4 + with: + name: waterbox-cores + path: | + Assets/dll/ares64_interpreter.wbx.zst + Assets/dll/ares64_recompiler.wbx.zst + Assets/dll/bsnes.wbx.zst + Assets/dll/dsda.wbx.zst + Assets/dll/faust.wbx.zst + Assets/dll/gpgx.wbx.zst + Assets/dll/hyper.wbx.zst + Assets/dll/libsnes.wbx.zst + Assets/dll/melonDS.wbx.zst + Assets/dll/ngp.wbx.zst + Assets/dll/pcfx.wbx.zst + Assets/dll/picodrive.wbx.zst + Assets/dll/shock.wbx.zst + Assets/dll/snes9x.wbx.zst + Assets/dll/ss.wbx.zst + Assets/dll/stella.wbx.zst + Assets/dll/tic80.wbx.zst + Assets/dll/turbo.wbx.zst + Assets/dll/uae.wbx.zst + Assets/dll/uzem.wbx.zst + Assets/dll/vb.wbx.zst + Assets/dll/virtualjaguar.wbx.zst diff --git a/.github/workflows/waterbox.yml b/.github/workflows/waterbox.yml new file mode 100644 index 0000000000..c71fc57dc0 --- /dev/null +++ b/.github/workflows/waterbox.yml @@ -0,0 +1,61 @@ +name: Build Waterbox + +on: + pull_request: + branches: [ "master" ] + paths: [ "waterbox/libcxx/**", "waterbox/musl/**" ] + push: + branches: [ "master" ] + paths: [ "waterbox/libcxx/**", "waterbox/musl/**" ] + workflow_dispatch: + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-waterbox + cancel-in-progress: true + +env: + CC: clang-18 + +jobs: + + build-waterbox: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install clang 18 + run: wget https://apt.llvm.org/llvm.sh; + chmod u+x llvm.sh; + sudo ./llvm.sh 18; + clang-18 --version; + - name: Set up env variable + run: echo "CLANG_VERSION=$(clang-18 -dumpversion)" >> $GITHUB_ENV + - name: Cache waterbox + id: cache-waterbox + uses: actions/cache@v4 + with: + path: waterbox/sysroot + key: waterbox-${{ hashFiles('waterbox/libcxx/configure-for-waterbox-phase-*', 'waterbox/libcxx/setup-llvm.sh', 'waterbox/libcxx/do-everything.sh') }}-${{ env.CLANG_VERSION }} + + - if: ${{ steps.cache-waterbox.outputs.cache-hit != 'true' }} + name: Checkout submodule + working-directory: ./waterbox/ + run: git submodule update --init musl + - if: ${{ steps.cache-waterbox.outputs.cache-hit != 'true' }} + name: Build musl + working-directory: ./waterbox/musl + run: ./wbox_configure.sh; + ./wbox_build.sh; + - if: ${{ steps.cache-waterbox.outputs.cache-hit != 'true' }} + name: Build libcxx + working-directory: ./waterbox/libcxx + run: ./do-everything.sh + - if: ${{ steps.cache-waterbox.outputs.cache-hit != 'true' }} + name: Build nyma zlib + working-directory: ./waterbox/nyma + run: ./build-and-install-zlib.sh + - name: Upload compiled waterbox + uses: actions/upload-artifact@v4 + with: + name: compiled-waterbox + path: waterbox/sysroot