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: push:
branches: branches:
- master - master
- feature/gh-actions-switch-cache
tags: tags:
- '*' - '*'
pull_request: {} pull_request: {}
@ -15,21 +16,27 @@ jobs:
container: container:
image: 'devkitpro/devkita64' image: 'devkitpro/devkita64'
steps: 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 - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 1 # We need 0 so we get all commits for mtime!
fetch-depth: 0
path: "./stk-code" path: "./stk-code"
- name: Checkout OpenAL - name: Checkout OpenAL
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 1 fetch-depth: 0
path: "./stk-code/lib/openal" path: "./stk-code/lib/openal"
repository: "kcat/openal-soft" repository: "kcat/openal-soft"
- name: Checkout Harfbuzz - name: Checkout Harfbuzz
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 1 fetch-depth: 0
path: "./stk-code/lib/harfbuzz" path: "./stk-code/lib/harfbuzz"
repository: "harfbuzz/harfbuzz" repository: "harfbuzz/harfbuzz"
- name: Grab assets - name: Grab assets
@ -39,6 +46,16 @@ jobs:
wget -q https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip 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 unzip -q stk-assets-full.zip -d stk-assets
rm stk-assets-full.zip 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! # Env setup!
- name: Configure packaging name for git master branch - name: Configure packaging name for git master branch
@ -74,8 +91,16 @@ jobs:
id: cache-switch-cmake id: cache-switch-cmake
uses: actions/cache@v2 uses: actions/cache@v2
with: 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: | 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/openal/cmake_build
stk-code/lib/harfbuzz/cmake_build stk-code/lib/harfbuzz/cmake_build
# Make sure PRs can't overwrite! # Make sure PRs can't overwrite!
@ -97,4 +122,3 @@ jobs:
omitNameDuringUpdate: true omitNameDuringUpdate: true
allowUpdates: true allowUpdates: true
prerelease: ${{ env.release_pre }} prerelease: ${{ env.release_pre }}

View File

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