diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23d35d07d8..ecbd015685 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,9 +40,6 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04] - env: - CCACHE_DIR: /home/runner/.ccache - CCACHE_MAXSIZE: 500M steps: - uses: actions/checkout@v4 @@ -53,7 +50,7 @@ jobs: sudo apt update # TTK dependencies sudo apt install -y \ - ccache \ + cargo \ libboost-system-dev \ libeigen3-dev \ libgraphviz-dev \ @@ -67,6 +64,13 @@ jobs: libqhull-dev \ dpkg-dev sudo python3 -m pip install scikit-learn + cargo install sccache --version 0.4.2 --locked + echo "PATH=/root/.cargo/bin:$PATH" >> $GITHUB_ENV + + - name: Install and setup sccache + uses: f3d-app/sccache-setup-action@v1 + with: + key: ${{ matrix.os }}-0 - name: Install optional dependencies uses: ./.github/actions/install-deps-unix @@ -79,18 +83,6 @@ jobs: unzip libtorch-cxx11-abi-shared-with-deps-2.3.1+cpu.zip sudo cp -R libtorch/* /usr/local/ - - name: Fetch archived ccache - continue-on-error: true - run: | - wget -O ttk-ccache.tar.gz \ - https://github.com/topology-tool-kit/ttk/releases/download/ccache/ttk-ccache-${{ matrix.os }}.tar.gz - - - name: Decompress ccache archive - continue-on-error: true - run: | - tar xzf ttk-ccache.tar.gz - mv .ccache /home/runner/ - - name: Fetch TTK-ParaView headless Debian package run: | wget -O ttk-paraview-headless.deb \ @@ -106,8 +98,8 @@ jobs: cd build cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ -DCMAKE_INSTALL_PREFIX=/usr \ -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \ -DTTK_BUILD_VTK_WRAPPERS=TRUE \ @@ -130,6 +122,10 @@ jobs: cpack -G DEB sudo cmake --build . --target install + - name: Show sccache results + shell: bash + run: sccache --show-stats + - name: Run TTK tests uses: ./.github/actions/test-ttk-unix @@ -139,22 +135,6 @@ jobs: name: ttk-for-tests-${{ matrix.os }}.deb path: build/ttk.deb - - name: Archive cache - run: | - ccache -s - ccache -c - cd /home/runner - tar czf ttk-ccache.tar.gz .ccache - - - name: Upload ccache archive - if: ${{ github.repository_owner == 'topology-tool-kit' && contains(github.ref, 'heads') }} - uses: actions/upload-artifact@v4 - with: - name: ttk-ccache-${{ matrix.os }} - path: /home/runner/ttk-ccache.tar.gz - retention-days: 2 - - # ------------------# # Tests on ttk-data # # ------------------# @@ -279,9 +259,7 @@ jobs: test-build-macos: runs-on: macos-12 if: ${{ github.repository_owner == 'topology-tool-kit' || !contains(github.ref, 'heads') }} - env: - CCACHE_DIR: /Users/runner/work/ttk/.ccache - CCACHE_MAXSIZE: 200M + steps: - uses: actions/checkout@v4 name: Checkout TTK source code @@ -297,25 +275,16 @@ jobs: brew install --cask xquartz brew install llvm ninja open-mpi # TTK dependencies - brew install boost eigen graphviz numpy qhull ccache - # prepend ccache to system path - echo "$(brew --prefix)/opt/ccache/libexec" >> $GITHUB_PATH + brew install boost eigen graphviz numpy qhull + + - name: Install and setup sccache + uses: f3d-app/sccache-setup-action@v1 + with: + key: macos-0 - name: Install optional dependencies uses: ./.github/actions/install-deps-unix - - name: Fetch archived ccache - continue-on-error: true - run: | - wget https://github.com/topology-tool-kit/ttk/releases/download/ccache/ttk-ccache-macOS.tar.gz - - - name: Decompress ccache archive - continue-on-error: true - run: | - tar xzf ttk-ccache-macOS.tar.gz - rm -rf /Users/runner/work/ttk/.ccache - mv .ccache /Users/runner/work/ttk/ - - name: Fetch TTK-ParaView headless macOS binary archive run: | wget https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-macos-12.tar.gz @@ -337,8 +306,8 @@ jobs: cd build cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \ -DTTK_BUILD_VTK_WRAPPERS=TRUE \ -DTTK_BUILD_STANDALONE_APPS=TRUE \ @@ -359,6 +328,10 @@ jobs: cmake --build . --parallel sudo cmake --build . --target install + - name: Show sccache results + shell: bash + run: sccache --show-stats + - name: Set PYTHONPATH for macOS pvpython run: | # pvpython does not embed the correct PYTHONPATH @@ -407,22 +380,6 @@ jobs: cat python/res.json diff python/hashes/macOS.json python/res.json - - name: Archive cache - run: | - ccache -s - ccache -c - cd /Users/runner/work/ttk - tar czf ttk-ccache.tar.gz .ccache - - - name: Upload ccache archive - if: ${{ github.repository_owner == 'topology-tool-kit' && contains(github.ref, 'heads') }} - uses: actions/upload-artifact@v4 - with: - name: ttk-ccache-macOS - path: /Users/runner/work/ttk/ttk-ccache.tar.gz - retention-days: 2 - - # ------------------ # # Test Windows build # # ------------------ # @@ -433,7 +390,6 @@ jobs: PV_DIR: C:\Program Files\TTK-ParaView TTK_DIR: C:\Program Files (x86)\ttk CONDA_ROOT: C:\Miniconda - SCCACHE_CACHE_SIZE: 200M steps: - uses: actions/checkout@v4 name: Checkout TTK source code @@ -444,32 +400,22 @@ jobs: shell: bash run: | conda install -c conda-forge libboost-devel glew eigen spectralib zfp \ - scikit-learn graphviz ninja sccache=0.4.2 python=3.10 zlib qhull llvm-openmp clangxx - # add sccache to PATH - echo "$CONDA_ROOT/bin" >> $GITHUB_PATH + scikit-learn graphviz ninja python=3.10 zlib qhull llvm-openmp clangxx # add TTK & ParaView install folders to PATH echo "$PV_DIR/bin" >> $GITHUB_PATH echo "$TTK_DIR/bin" >> $GITHUB_PATH conda info --all + - name: Install and setup sccache + uses: f3d-app/sccache-setup-action@v1 + with: + key: windows-0 + - name: Remove hosted Python shell: bash run: | rm -rf C:/hostedtoolcache/windows/Python - - name: Fetch archived ccache - continue-on-error: true - run: | - curl.exe -OL https://github.com/topology-tool-kit/ttk/releases/download/ccache/ttk-sccache-windows.tar.gz - - - name: Decompress ccache archive - continue-on-error: true - shell: bash - run: | - tar xzf ttk-sccache-windows.tar.gz - mkdir -p /c/Users/runneradmin/AppData/Local/Mozilla/sccache - mv cache /c/Users/runneradmin/AppData/Local/Mozilla/sccache - - name: Fetch TTK-ParaView headless Windows installer run: | curl.exe -OL https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless.exe @@ -486,8 +432,6 @@ jobs: set CC=clang-cl.exe set CXX=clang-cl.exe call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - sccache --stop-server - sccache --start-server mkdir build cd build cmake ^ @@ -530,6 +474,10 @@ jobs: call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cmake --build . --config Release --parallel --target install + - name: Show sccache results + shell: bash + run: sccache --show-stats + - name: Test C++ example shell: cmd run: | @@ -610,99 +558,3 @@ jobs: cd ttk-data type python\res.json FC python\hashes\windows.json python\res.json - - - name: Archive cache - shell: bash - run: | - sccache -s - cd /c/Users/runneradmin/AppData/Local/Mozilla/sccache - tar czf ttk-sccache.tar.gz cache - - - name: Upload sccache archive - if: ${{ github.repository_owner == 'topology-tool-kit' && contains(github.ref, 'heads') }} - uses: actions/upload-artifact@v4 - with: - name: ttk-sccache-windows - path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\ttk-sccache.tar.gz - retention-days: 2 - - - # ---------------------------------------- # - # Upload ccache archives as release assets # - # ---------------------------------------- # - ccache-release: - runs-on: ubuntu-latest - needs: [test-build-ubuntu, test-build-macos, test-build-windows] - # trigger job only on the "topology-tool-kit" repository in case - # of a branch push (pull requests and tags not affected) - if: ${{ github.repository_owner == 'topology-tool-kit' && contains(github.ref, 'heads') }} - steps: - - - name: Delete previous release - uses: actions/github-script@v6 - continue-on-error: true - with: - script: | - const { owner, repo } = context.repo - const { data: { id } } = await github.rest.repos.getReleaseByTag({ - owner, - repo, - tag: "ccache" - }) - await github.rest.repos.deleteRelease({ owner, repo, release_id: id }) - - - name: Create Release - uses: actions/github-script@v6 - with: - script: | - const { owner, repo } = context.repo - await github.rest.repos.createRelease({ - owner, - repo, - tag_name: "ccache", - name: "ccache archives", - body: "Holds ccache archives to speed up build jobs", - draft: false, - prerelease: true - }) - - - name: Fetch all uploaded artifacts - uses: actions/download-artifact@v4.1.7 - - - name: Upload Ubuntu Focal .deb as Release Asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ccache - file: ttk-ccache-ubuntu-20.04/ttk-ccache.tar.gz - asset_name: ttk-ccache-ubuntu-20.04.tar.gz - - - name: Upload Ubuntu Jammy .deb as Release Asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ccache - file: ttk-ccache-ubuntu-22.04/ttk-ccache.tar.gz - asset_name: ttk-ccache-ubuntu-22.04.tar.gz - - - name: Upload .pkg as Release Asset - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ccache - file: ttk-ccache-macOS/ttk-ccache.tar.gz - asset_name: ttk-ccache-macOS.tar.gz - - - name: Upload sccache Windows archive - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ccache - file: ttk-sccache-windows/ttk-sccache.tar.gz - asset_name: ttk-sccache-windows.tar.gz - - - name: Delete ccache artifacts - uses: geekyeggo/delete-artifact@v2 - with: - name: | - ttk-*ccache*