Explorar el Código

Enable cache action.

Yao Wei Tjong 姚伟忠 hace 5 años
padre
commit
c875f1796d
Se han modificado 2 ficheros con 19 adiciones y 3 borrados
  1. 17 3
      .github/workflows/main.yml
  2. 2 0
      Rakefile

+ 17 - 3
.github/workflows/main.yml

@@ -65,11 +65,25 @@ jobs:
         uses: actions/checkout@v2
         with:
           fetch-depth: ${{ env.FETCH_DEPTH }}
-      - name: Free up spaces
+      - name: Free up space
         run: sudo rm -rf microsoft mssql-toos cni hostedtoolcache /usr/local/share/boost /usr/share/dotnet /usr/local/lib/android /opt/ghc "$AGENT_TOOLSDIRECTORY"
         if: matrix.platform == 'android'
+      - name: Cache
+        uses: actions/cache@v2
+        with:
+          path: |
+            build/cache/.ccache
+            build/cache/.gradle/caches
+            build/cache/.gradle/wrapper
+          key: ${{ env.DBE_TAG }}-${{ matrix.platform }}-${{ matrix.lib-type }}-${{ matrix.architecture }}-${{ github.sha }}
+          restore-keys: ${{ env.DBE_TAG }}-${{ matrix.platform }}-${{ matrix.lib-type }}-${{ matrix.architecture }}
       - name: Build
-        run: script/dockerized.sh ${PLATFORM/-*} rake ci build
+        run: |
+          docker volume create $(id -u).urho3d_home_dir >/dev/null
+          sudo rm -rf /var/lib/docker/volumes/$(id -u).urho3d_home_dir/_data
+          mkdir -p build/cache
+          sudo ln -s $(pwd)/build/cache /var/lib/docker/volumes/$(id -u).urho3d_home_dir/_data
+          script/dockerized.sh ${PLATFORM/-*} rake ci build
   macOS:
     name: 🍏
     runs-on: macos-latest
@@ -106,7 +120,7 @@ jobs:
       fail-fast: false
       matrix:
         platform:
-          - win-msvc
+          - win-vs
           - win-gcc
         lib-type:
           - STATIC

+ 2 - 0
Rakefile

@@ -62,6 +62,7 @@ end
 
 desc 'Build the software'
 task build: [:cmake] do
+  system "ccache -z" if ENV['CI'] && ENV['USE_CCACHE']
   if ENV['PLATFORM'] == 'android'
     Rake::Task['gradle'].invoke('build')
     next
@@ -90,6 +91,7 @@ task build: [:cmake] do
     concurrent = "-j#{$max_jobs}"
   end
   system %Q{cmake --build "#{build_tree}" #{config} #{target} -- #{concurrent} #{ENV['BUILD_PARAMS']}} or abort
+  system "ccache -s" if ENV['CI'] && ENV['USE_CCACHE']
 end