Fix switch github actions cache (#4519)

This commit is contained in:
Mary 2021-04-13 13:01:09 -04:00 committed by GitHub
parent 16e232091d
commit 65faa029ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 20 deletions

View File

@ -3,6 +3,7 @@ on:
push:
branches:
- master
- feature/gh-actions-switch-cache
tags:
- '*'
pull_request: {}
@ -15,21 +16,27 @@ jobs:
container:
image: 'devkitpro/devkita64'
steps:
- name: Install git
run: |
echo "deb http://ftp.debian.org/debian stretch-backports main" | sudo tee /etc/apt/sources.list.d/stretch-backports.list
sudo apt update
sudo apt install -t stretch-backports git -y
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 1
# We need 0 so we get all commits for mtime!
fetch-depth: 0
path: "./stk-code"
- name: Checkout OpenAL
uses: actions/checkout@v2
with:
fetch-depth: 1
fetch-depth: 0
path: "./stk-code/lib/openal"
repository: "kcat/openal-soft"
- name: Checkout Harfbuzz
uses: actions/checkout@v2
with:
fetch-depth: 1
fetch-depth: 0
path: "./stk-code/lib/harfbuzz"
repository: "harfbuzz/harfbuzz"
- name: Grab assets
@ -39,6 +46,16 @@ jobs:
wget -q https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip
unzip -q stk-assets-full.zip -d stk-assets
rm stk-assets-full.zip
- name: Restore modified date
run: |
sudo apt install -y git-restore-mtime
cd stk-code
git restore-mtime .
cd lib/openal
git restore-mtime .
cd ../../lib/harfbuzz
git restore-mtime .
cd ../../..
# Env setup!
- name: Configure packaging name for git master branch
@ -74,8 +91,16 @@ jobs:
id: cache-switch-cmake
uses: actions/cache@v2
with:
# This is unnecessarily verbose and might break, but again ! seems broken
# See: https://github.com/Mstrodl/stk-code/runs/2333673736?check_suite_focus=true#step:16:34
path: |
stk-code/cmake_build
stk-code/cmake_build/CMakeFiles
stk-code/cmake_build/Makefile
stk-code/cmake_build/lib
stk-code/cmake_build/bin/supertuxkart
stk-code/cmake_build/*.cmake
stk-code/cmake_build/*.txt
stk-code/lib/openal/cmake_build
stk-code/lib/harfbuzz/cmake_build
# Make sure PRs can't overwrite!
@ -97,4 +122,3 @@ jobs:
omitNameDuringUpdate: true
allowUpdates: true
prerelease: ${{ env.release_pre }}

View File

@ -17,8 +17,6 @@ fi
OPTIONAL=""
if [ ! -f "$DEVKITPRO/switch.cmake" ]; then
echo "pkgbuild-helpers not installed!"
ls "$DEVKITPRO/switch.cmake"
ls "$DEVKITPRO"
OPTIONAL="devkitpro-pkgbuild-helpers"
fi
@ -92,23 +90,19 @@ fi
echo "Compiling STK"
if [[ ! -d "${STK_DIR}/cmake_dir" ]]; then
if [[ ! -d "${STK_DIR}/cmake_build" ]]; then
mkdir "${STK_DIR}/cmake_build"
else
ls "${STK_DIR}/cmake_build"
fi
cd "${STK_DIR}/cmake_build"
if [[ ! -f "${STK_DIR}/cmake_build/CMakeCache.txt" ]]; then
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="${DEVKITPRO}/switch.cmake" \
-DUSE_SWITCH=ON \
-DOPENAL_LIBRARY="${STK_DIR}/lib/openal/cmake_build/install/lib/libopenal.a" \
-DOPENAL_INCLUDE_DIR="${STK_DIR}/lib/openal/cmake_build/install/include" \
-DHARFBUZZ_LIBRARY="${STK_DIR}/lib/harfbuzz/cmake_build/install/lib/libharfbuzz.a" \
-DHARFBUZZ_INCLUDEDIR="${STK_DIR}/lib/harfbuzz/cmake_build/install/include" \
-DCMAKE_INSTALL_PREFIX=/ \
../
fi
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="${DEVKITPRO}/switch.cmake" \
-DUSE_SWITCH=ON \
-DOPENAL_LIBRARY="${STK_DIR}/lib/openal/cmake_build/install/lib/libopenal.a" \
-DOPENAL_INCLUDE_DIR="${STK_DIR}/lib/openal/cmake_build/install/include" \
-DHARFBUZZ_LIBRARY="${STK_DIR}/lib/harfbuzz/cmake_build/install/lib/libharfbuzz.a" \
-DHARFBUZZ_INCLUDEDIR="${STK_DIR}/lib/harfbuzz/cmake_build/install/include" \
-DCMAKE_INSTALL_PREFIX=/ \
../
make -j$(nproc)
make install DESTDIR=./install
@ -131,6 +125,9 @@ echo "Compressing"
# Zip up actual release:
cd sdcard
ZIP_PATH="${STK_DIR}/cmake_build/bin/SuperTuxKart-${PROJECT_VERSION}-switch.zip"
if [[ -f "${ZIP_PATH}" ]]; then
rm "${ZIP_PATH}"
fi
zip -r "${ZIP_PATH}" .
# Recover old pwd