From 4cf6d64b3965f5a41ff4b9b1126fec24ad107396 Mon Sep 17 00:00:00 2001 From: Michael Rapp Date: Sun, 12 Nov 2023 00:23:53 +0100 Subject: [PATCH] Cache build files in Github workflows. --- .github/workflows/test_build.yml | 81 ++++++++++++++++++++++++++++--- .github/workflows/test_format.yml | 25 ++++++++-- 2 files changed, 97 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_build.yml b/.github/workflows/test_build.yml index 8c51f7dace..9624b79a35 100644 --- a/.github/workflows/test_build.yml +++ b/.github/workflows/test_build.yml @@ -17,6 +17,7 @@ jobs: python: ${{ steps.filter.outputs.python }} python_tests: ${{ steps.filter.outputs.python_tests }} doc: ${{ steps.filter.outputs.doc }} + any: ${{ steps.filter.outputs.any }} steps: - name: Look up Git repository in cache uses: actions/cache/restore@v3 @@ -39,27 +40,32 @@ jobs: - '**/*.pxd' - '**/*.pyx' - '**/meson.build' - cpp_tests: + cpp_tests: &cpp_tests - *cpp - 'cpp/**/test/**' python: &python - 'scons/**' - 'python/requirements.txt' - 'python/**/mlrl/**' - python_tests: + python_tests: &python_tests - *python - python/**/tests/** - doc: + doc: &doc - 'scons/**' - 'doc/**' + any: + - *cpp_tests + - *python_tests + - *doc - name: Save Git repository to cache uses: actions/cache/save@v3 - if: always() + if: success() || failure() with: path: Boomer/.git/ key: test-build-git linux_build: needs: changes + if: ${{ needs.changes.outputs.any == 'true' }} name: Test Linux build runs-on: ubuntu-latest steps: @@ -73,13 +79,26 @@ jobs: with: path: Boomer/ - name: Install OpenCL - if: ${{ needs.changes.outputs.cpp_tests == 'true' || needs.changes.outputs.python_tests == 'true' || needs.changes.outputs.doc == 'true' }} run: | sudo apt update sudo apt install -y opencl-headers ocl-icd-opencl-dev - name: Install GoogleTest - if: ${{ needs.changes.outputs.cpp_tests == 'true' || needs.changes.outputs.python_tests == 'true' || needs.changes.outputs.doc == 'true' }} run: sudo apt install -y googletest + - name: Look up build files in cache + uses: actions/cache/restore@v3 + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + - Boomer/cpp/build/ + - Boomer/python/**/cython/*.so* + - Boomer/python/**/build/ + - Boomer/python/**/dist/ + - Boomer/python/**/*egg-info/ + - Boomer/doc/_build/ + - Boomer/doc/_extra/ + - Boomer/doc/development/api/python/ + key: ${{ runner.os }}-test-build-tmp-files - name: Test C++ code if: ${{ needs.changes.outputs.cpp_tests == 'true' }} run: ./build tests_cpp @@ -101,6 +120,22 @@ jobs: - name: Generate Documentation if: ${{ needs.changes.outputs.doc == 'true' }} run: ./build doc + - name: Save build files to cache + uses: actions/cache/save@v3 + if: success() || failure() + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + - Boomer/cpp/build/ + - Boomer/python/**/cython/*.so* + - Boomer/python/**/build/ + - Boomer/python/**/dist/ + - Boomer/python/**/*egg-info/ + - Boomer/doc/_build/ + - Boomer/doc/_extra/ + - Boomer/doc/development/api/python/ + key: ${{ runner.os }}-test-build-tmp-files macos_build: needs: changes if: ${{ needs.changes.outputs.cpp == 'true' }} @@ -122,8 +157,25 @@ jobs: brew link libomp --force - name: Install OpenCL run: brew install opencl-clhpp-headers + - name: Look up build files in cache + uses: actions/cache/restore@v3 + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + - Boomer/cpp/build/ + key: ${{ runner.os }}-test-build-tmp-files - name: Compile via Clang run: TEST_SUPPORT=disabled CPLUS_INCLUDE_PATH=/usr/local/opt/opencl-clhpp-headers/include ./build compile + - name: Save build files to cache + uses: actions/cache/save@v3 + if: success() || failure() + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + - Boomer/cpp/build/ + key: ${{ runner.os }}-test-build-tmp-files windows_build: needs: changes if: ${{ needs.changes.outputs.cpp == 'true' }} @@ -152,9 +204,26 @@ jobs: pkgs: opencl triplet: x64-windows token: ${{ github.token }} + - name: Look up build files in cache + uses: actions/cache/restore@v3 + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + - Boomer/cpp/build/ + key: ${{ runner.os }}-test-build-tmp-files - name: Compile via MSVC run: | $env:TEST_SUPPORT = "disabled" $env:INCLUDE += ";$($pwd.Path)\vcpkg\packages\opencl_x64-windows\include" $env:LIB += ";$($pwd.Path)\vcpkg\packages\opencl_x64-windows\lib" ./build.bat compile + - name: Save build files to cache + uses: actions/cache/save@v3 + if: success() || failure() + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + - Boomer/cpp/build/ + key: ${{ runner.os }}-test-build-tmp-files diff --git a/.github/workflows/test_format.yml b/.github/workflows/test_format.yml index 37c4f58473..f54219f85f 100644 --- a/.github/workflows/test_format.yml +++ b/.github/workflows/test_format.yml @@ -31,26 +31,45 @@ jobs: with: working-directory: Boomer/ filters: | - cpp: + cpp: &cpp - 'scons/**' - '**/*.hpp' - '**/*.cpp' - '.clang-format' - python: + python: &python - 'scons/**' - '**/*.py' - '.isort.cfg' - '.pylintrc' - '.style.yapf' + any: + - *cpp + - *python + - name: Look up build files in cache + uses: actions/cache/restore@v3 + if: steps.filter.outputs.any == 'true' + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + key: test-format-tmp-files - name: Check C++ code style if: steps.filter.outputs.cpp == 'true' run: ./build test_format_cpp - name: Check Python code style if: steps.filter.outputs.python == 'true' run: ./build test_format_python + - name: Save build files to cache + uses: actions/cache/save@v3 + if: (success() || failure()) && steps.filter.outputs.any == 'true' + with: + path: | + - Boomer/venv/ + - Boomer/scons/build/ + key: test-format-tmp-files - name: Save Git repository to cache uses: actions/cache/save@v3 - if: always() + if: success() || failure() with: path: Boomer/.git/ key: test-format-git