From 4d17265e90b9900e00c38ffab137b31cffd734f6 Mon Sep 17 00:00:00 2001 From: iTrooz_ Date: Mon, 10 Oct 2022 20:37:00 +0200 Subject: [PATCH] git: Use action to manage ccache + minor fixes (#775) * use action for ccache + limit cache size * remove 'prepare cache' step for Windows * remove libpython from CI * fix the restore key for MacOS * remove Rust from CI * do not pin appimage-builder version since issue with it has been resolved * use ccache action for CodeQL * Rebased onto latest master Co-authored-by: WerWolv --- .github/workflows/analysis.yml | 9 ++--- .github/workflows/build.yml | 70 +++++++++------------------------- .github/workflows/tests.yml | 7 ++-- 3 files changed, 24 insertions(+), 62 deletions(-) diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 687617bcc..8ffb5971d 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -25,14 +25,13 @@ jobs: with: languages: 'cpp' - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: | - ~/.cache/ccache key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build - + max-size: 50M + - name: 📜 Restore CMakeCache uses: actions/cache@v3 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8485b6157..9325f3e1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,21 +28,13 @@ jobs: with: submodules: recursive - - name: 📜 Prepare Cache - id: prep-ccache - shell: bash - run: | - mkdir -p "${CCACHE_DIR}" - echo "::set-output name=dir::$CCACHE_DIR" - - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 id: cache-ccache with: - path: | - ${{ steps.prep-ccache.outputs.dir }} key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build + max-size: 50M - name: 📜 Restore CMakeCache uses: actions/cache@v3 @@ -64,37 +56,23 @@ jobs: glfw:p file:p mbedtls:p - python:p freetype:p dlfcn:p - - name: ⬇️ Install dependencies - run: | - curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs > rustup-init.exe - ./rustup-init.exe -y --default-host=x86_64-pc-windows-gnu --default-toolchain=none - rm rustup-init.exe - $USERPROFILE/.cargo/bin/rustup.exe target add x86_64-pc-windows-gnu - $USERPROFILE/.cargo/bin/rustup.exe default nightly - # Windows cmake build - name: 🛠️ Build run: | mkdir -p build cd build - # Get path to mingw python library - PYTHON_LIB_NAME=$(pkg-config --libs-only-l python3 | sed 's/^-l//' | sed 's/ //') - PYTHON_LIB_PATH=$(cygpath -m $(which lib${PYTHON_LIB_NAME}.dll)) cmake -G "MinGW Makefiles" \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_INSTALL_PREFIX="$PWD/install" \ -DCREATE_PACKAGE=ON \ - -DPython_LIBRARY="$PYTHON_LIB_PATH" \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_FLAGS="-fuse-ld=lld" \ -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ - -DRUST_PATH="$USERPROFILE/.cargo/bin/" \ -DIMHEX_PATTERNS_PULL_MASTER=ON \ .. mingw32-make -j4 install @@ -166,13 +144,12 @@ jobs: run: | echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: | - ~/Library/Caches/ccache key: ${{ runner.os }}-${{ matrix.suffix }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} - restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build + restore-keys: ${{ runner.os }}-${{ matrix.suffix }}-${{ secrets.CACHE_VERSION }}-build + max-size: 50M - name: 📜 Restore CMakeCache @@ -260,13 +237,12 @@ jobs: with: submodules: recursive - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: | - ~/.cache/ccache key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build + max-size: 50M - name: 📜 Restore other caches uses: actions/cache@v3 @@ -290,14 +266,7 @@ jobs: sudo apt install -y python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fuse sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool sudo chmod +x /usr/local/bin/appimagetool - sudo pip3 install appimage-builder==1.0.0 - - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh - sh rustup-init.sh -y --default-toolchain none - rm rustup-init.sh - $HOME/.cargo/bin/rustup install nightly - $HOME/.cargo/bin/rustup target add x86_64-unknown-linux-gnu - $HOME/.cargo/bin/rustup default nightly + sudo pip3 install appimage-builder # Ubuntu cmake build - name: 🛠️ Build @@ -311,7 +280,6 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_FLAGS="-fuse-ld=lld" \ -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ - -DRUST_PATH="$HOME/.cargo/bin/" \ -DIMHEX_PATTERNS_PULL_MASTER=ON \ .. make -j 4 install DESTDIR=DebDir @@ -347,7 +315,6 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_FLAGS="-fuse-ld=lld" \ -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ - -DRUST_PATH="$HOME/.cargo/bin/" \ -DIMHEX_PATTERNS_PULL_MASTER=ON \ -DIMHEX_PLUGINS_IN_SHARE=ON \ -DIMHEX_USE_BUNDLED_CA=ON \ @@ -412,13 +379,12 @@ jobs: run: | dist/get_deps_archlinux.sh --noconfirm - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: | - ~/.cache/ccache key: archlinux-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} restore-keys: archlinux-${{ secrets.CACHE_VERSION }}-build + max-size: 50M - name: 📜 Restore CMakeCache uses: actions/cache@v3 @@ -514,7 +480,6 @@ jobs: libcurl-devel \ llvm-devel \ mbedtls-devel \ - python3-devel \ rpm-build \ yara-devel @@ -527,13 +492,12 @@ jobs: run: | dist/get_deps_fedora.sh - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: | - ~/.cache/ccache key: fedora-${{ matrix.release }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} restore-keys: fedora-${{ matrix.release }}-${{ secrets.CACHE_VERSION }}-build + max-size: 50M - name: 📜 Set version variable run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0bc8ab1c9..0038df932 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,13 +22,12 @@ jobs: with: submodules: recursive - - name: 📜 Restore ccache - uses: actions/cache@v3 + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: | - ~/.cache/ccache key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }} restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build + max-size: 50M - name: 📜 Restore CMakeCache