Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci skip] Cache refinement #114

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,25 @@ jobs:
git config --global user.name "GitHub Actions"
git config --global init.defaultBranch master

- name: Check cache for Paper Base
id: cache-base-check
uses: actions/cache@v3
env:
cache-name: cache-paper-base
with:
path: ./base
key: cache-paper-base-master
- name: Setup build environment
if: ${{ steps.cache-base-check.outputs.cache-hit != 'true' }}
run: ./panda setup

- name: Save cache for Paper Base
if: ${{ steps.cache-base-check.outputs.cache-hit != 'true' }}
id: cache-base-save
uses: actions/cache/save@v3
with:
path: ./base
key: ${{ steps.cache-base-check.outputs.cache-primary-key }}
- name: Apply patches
run: ./panda patch

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,24 @@ jobs:
git config --global user.name "GitHub Actions"
git config --global init.defaultBranch master

- name: Check cache for Paper Base
id: cache-base-check
uses: actions/cache@v3
env:
cache-name: cache-paper-base
with:
path: ./base
key: cache-paper-base-master
- name: Setup build environment
if: ${{ steps.cache-base-check.outputs.cache-hit != 'true' }}
run: ./panda setup
- name: Save cache for Paper Base
if: ${{ steps.cache-base-check.outputs.cache-hit != 'true' }}
id: cache-base-save
uses: actions/cache/save@v3
with:
path: ./base
key: ${{ steps.cache-base-check.outputs.cache-primary-key }}

- name: Apply patches
run: ./panda patch
Expand Down
2 changes: 1 addition & 1 deletion panda
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ case "$1" in
(
set -e
cd "$basedir"
scripts/build.sh "$basedir" || exit 1
./scripts/applyPatches.sh "$basedir" || exit 1
) || failed=1
;;
"j" | "jar")
Expand Down
23 changes: 13 additions & 10 deletions scripts/applyPatches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,21 @@ if [ "$2" == "--setup" ] || [ "$2" == "--jar" ]; then
echo "Importing MC Dev"

./scripts/importmcdev.sh "$basedir" || exit 1
if [ "$2" == "--setup" ]; then
exit 1
fi
elif [ ! -d "base/Paper/PaperSpigot-Server" ]; then
echo "Upstream directory does not exist. Did you forget to run 'panda setup'?"
exit 1
else
# Apply PandaSpigot
(
applyPatch "base/Paper/PaperSpigot-API" PandaSpigot-API HEAD patches/api &&
applyPatch "base/Paper/PaperSpigot-Server" PandaSpigot-Server HEAD patches/server
cd "$basedir"
) || (
echo "Failed to apply Paper Patches"
exit 1
) || exit 1
fi

# Apply PandaSpigot
(
applyPatch "base/Paper/PaperSpigot-API" PandaSpigot-API HEAD patches/api &&
applyPatch "base/Paper/PaperSpigot-Server" PandaSpigot-Server HEAD patches/server
cd "$basedir"
) || (
echo "Failed to apply Paper Patches"
exit 1
) || exit 1
) || exit 1