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.
This commit is contained in:
Dav999-v 2023-03-24 18:10:09 +01:00 committed by Misa Elizabeth Kai
parent 0961084ff9
commit 62449dfa9a
1 changed files with 8 additions and 9 deletions

View File

@ -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: |