From 00a6e9cf4756210f9a608496e6ee71d84704de58 Mon Sep 17 00:00:00 2001 From: Zachary Hall Date: Sun, 20 Oct 2024 16:41:45 -0700 Subject: [PATCH] Add cache --- .forgejo/workflows/compile.yaml | 56 ++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/.forgejo/workflows/compile.yaml b/.forgejo/workflows/compile.yaml index 1d8c484..5623390 100644 --- a/.forgejo/workflows/compile.yaml +++ b/.forgejo/workflows/compile.yaml @@ -3,9 +3,23 @@ run-name: Build the project on: [push] jobs: - get-source-code: + download-system-deps: runs-on: ubuntu-latest steps: + - name: Download and cache system dependencies + uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest + with: + packages: zstd cmake build-essential python3 python3-pip python3-venv wget gcc-mingw-w64 g++-mingw-w64 ninja-build + version: 1.0 + get-source-code: + runs-on: ubuntu-latest + needs: download-system-deps + steps: + - name: Download and cache system dependencies + uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest + with: + packages: zstd + version: 1.0 - name: Check out repository code uses: actions/checkout@v3 with: @@ -14,8 +28,6 @@ jobs: fetch-depth: 0 - name: Set up SDL android project run: ./setup.sh && ./setup-android-project.sh - - name: Install ZSTD compressor - run: apt-get update && apt-get install -y zstd - name: Create archive run: rm source.tar.zst -f; tar --exclude-vcs -c --to-stdout --exclude=source.tar.zst ./* ./.* | zstd -19 -T0 -o source.tar.zst - name: Upload source code @@ -31,18 +43,28 @@ jobs: runs-on: ubuntu-latest needs: get-source-code steps: + - name: Download and cache system dependencies + uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest + with: + packages: zstd wget python3 python3-pip python3-venv cmake build-essential + version: 1.0 - name: Download repository code uses: actions/download-artifact@v3 with: name: source_archive path: . - - name: Install ZSTD compressor - run: apt-get update && apt-get install -y zstd - name: Extract repository code run: tar -xf source.tar.zst - - name: Install system dependencies - run: apt update && apt install -y wget python3 python3-pip python3-venv - - name: Install Python dependencies via pip + - name: Cache python dependencies + id: cache-python-deps + uses: actions/cache@v4 + with: + key: python-deps-${{ runner.os }}-python-${{ hashFiles('.forgejo/**') }} + path: venv + restore-keys: | + python-deps-${{ runner.os }}-python + - name: Create virtual environment and install Python dependencies + if: steps.cache-python-deps.cache-hit != 'true' run: python3 -m venv venv && ./venv/bin/pip install pylddwrap - name: Build project run: ./build-appimage.sh @@ -62,15 +84,20 @@ jobs: runs-on: ubuntu-latest needs: get-source-code steps: + - name: Download and cache system dependencies + uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest + with: + packages: zstd cmake build-essential ninja-build + version: 1.0 - name: Download repository code uses: actions/download-artifact@v3 with: name: source_archive path: . - - name: Install ZSTD compressor - run: apt-get update && apt-get install -y zstd - name: Extract repository code run: tar -xf source.tar.zst + - name: Build protoc + run: ./build-protoc.sh - name: Setup Java uses: fam-tech/setup-java@v3 with: @@ -102,19 +129,20 @@ jobs: runs-on: ubuntu-latest needs: get-source-code steps: + - name: Download and cache system dependencies + uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest + with: + packages: zstd cmake build-essential gcc-mingw-w64 g++-mingw-w64 ninja-build + version: 1.0 - name: Download repository code uses: actions/download-artifact@v3 with: name: source_archive path: . - - name: Install ZSTD compressor - run: apt-get update && apt-get install -y zstd - name: Extract repository code run: tar -xf source.tar.zst - name: Build protoc run: ./build-protoc.sh - - name: Install MinGW compiler - run: apt-get update && apt-get install gcc-mingw-w64 g++-mingw-w64 -y - name: Build with CMake run: mkdir -p build-windows && cd build-windows && cmake .. -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-gcc -G Ninja -DDISABLE_GTK_UI=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_LIBFMT=ON -DUSE_PORTALS=OFF -DENABLE_DBUS=OFF -DBUILD_STATIC=ON -DDOWNLOAD_AUDIO_CODECS_DEPENDENCY=ON -DSDL_MIXER_X_SHARED=OFF -DSDL_MIXER_X_STATIC=ON -DUSE_OGG_VORBIS_STB=ON -DUSE_OPUS=OFF -DUSE_MODPLUG=OFF -DUSE_GME=OFF -DUSE_WAVPACK=OFF -DUSE_XMP=OFF -DUSE_MIDI_EDMIDI=OFF -DUSE_SYSTEM_SDL2=OFF -DBUILD_PROTOC=OFF -DBUILD_SDL=ON -DBUILD_SDL_IMAGE=ON -DBUILD_JSONCPP=ON -DBUILD_SOUNDTOUCH=ON -DBUILD_PROTOBUF=ON -DDISABLE_IMGUI_UI=OFF && ninja && cd .. - name: Upload artifact