diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3591d0a9..19da0783 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6b2137c0..afbce62e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 diff --git a/panda b/panda index 2692b0b9..3747c519 100755 --- a/panda +++ b/panda @@ -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") diff --git a/scripts/applyPatches.sh b/scripts/applyPatches.sh index 70a24f3c..a698a799 100755 --- a/scripts/applyPatches.sh +++ b/scripts/applyPatches.sh @@ -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