From 62449dfa9a034ef2c79629fe10c94661f5a15460 Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Fri, 24 Mar 2023 18:10:09 +0100 Subject: [PATCH] CI: Skip "Download SDL" step instead of using Test-Path, use cache@v3 For some reason, this test takes a dozen seconds or more. Maybe because it needs to boot up powershell or something like that? No idea, but it's just sitting there. The cache action has a return value that indicates whether there was a cache hit, so there's no need to use Test-Path, saving CI time. EDIT: Maybe the SDL cache hasn't ever been working. It seems to cache 30 bytes (huh?) and the folder it caches is C:\SDL, not C:\SDL2-2.24.0 as the folder would look like. So it was probably downloading SDL every time anyway? Also, I upgraded the cache@v2 action to cache@v3. I added a cache@v3 myself and noticed this was still using cache@v2, so I figured, why not future-proof it? And that's when I notice this warning: "Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: actions/cache@v2." So it's pretty good timing. --- .github/workflows/ci.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1d4f231..fd342ce9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,20 +125,19 @@ jobs: submodules: true - name: Cache SDL - uses: actions/cache@v2 + id: cache-windows-sdl + uses: actions/cache@v3 env: cache-name: cache-sdl with: - path: C:\SDL - key: ${{ runner.os }}-build-${{ env.cache-name }} + path: C:\SDL2-* + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.SDL_VERSION }} - - name: Download SDL if not cached + - if: ${{ steps.cache-windows-sdl.outputs.cache-hit != 'true' }} + name: Download SDL if not cached run: | - if (-Not (Test-Path C:\SDL)) - { - Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$env:SDL_VERSION/SDL2-devel-$env:SDL_VERSION-VC.zip" -o C:\SDL.zip - Expand-Archive C:\SDL.zip -DestinationPath C:\ - } + Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$env:SDL_VERSION/SDL2-devel-$env:SDL_VERSION-VC.zip" -o C:\SDL.zip + Expand-Archive C:\SDL.zip -DestinationPath C:\ - name: CMake configure (default version) run: |