Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Better, Faster Build Piepline #17

Merged
merged 36 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f46463e
Update yapfa
duplexsystem Jul 15, 2020
5566583
Update yapfa
duplexsystem Jul 15, 2020
b8c158b
Fix
duplexsystem Jul 15, 2020
03da250
Merge branch 'HEAD' into origin/patch-3
duplexsystem Jul 15, 2020
c5ed9e9
useless test commit
duplexsystem Jul 15, 2020
0181a85
Update build.yml
duplexsystem Jul 15, 2020
f4a521a
Merge branch 'dev/ver/1.16.1' into patch-3
duplexsystem Jul 15, 2020
8063647
Update build.yml
duplexsystem Jul 15, 2020
ad83ab3
Update build.yml
duplexsystem Jul 15, 2020
71f53b7
Update importSources.sh
duplexsystem Jul 15, 2020
f204802
Fix
duplexsystem Jul 15, 2020
1aa6aae
Update build.yml
duplexsystem Jul 15, 2020
8bf2a0d
ok might possibly do something maybe
duplexsystem Jul 15, 2020
3134a5c
Fix 2
duplexsystem Jul 15, 2020
79bbf4a
behold! My fix!
duplexsystem Jul 15, 2020
8f0f008
Update build.yml
duplexsystem Jul 15, 2020
796dfb7
very cool fix that is very useful and does some thonking on it's own
duplexsystem Jul 15, 2020
ad54fc3
idk might work
duplexsystem Jul 15, 2020
9a7bb0f
CaPs
duplexsystem Jul 15, 2020
a2ef4f6
Faster No Cache Build
duplexsystem Jul 15, 2020
504e5d7
Update README.md
duplexsystem Jul 15, 2020
9486f23
Update build.yml
duplexsystem Jul 15, 2020
2ddbe13
Changes
duplexsystem Jul 17, 2020
6267d05
mmmm yes
duplexsystem Jul 17, 2020
5793d94
test
duplexsystem Jul 17, 2020
d55638b
test2
duplexsystem Jul 17, 2020
91d85c6
test3
duplexsystem Jul 17, 2020
167b30d
fixtypo
duplexsystem Jul 17, 2020
b1cf455
fallback 1
duplexsystem Jul 17, 2020
acf32c3
Use Java version maybe
duplexsystem Jul 17, 2020
8dcb34f
fix?
duplexsystem Jul 17, 2020
574af2b
fixed maybe
duplexsystem Jul 17, 2020
785b973
fix artifact
duplexsystem Jul 17, 2020
08f9503
update git ignore
duplexsystem Jul 17, 2020
f811828
Real Fix
duplexsystem Jul 17, 2020
e366cd2
Update build.yml
duplexsystem Jul 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,50 @@ name: CI

on: [push, pull_request]


jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
java: [11, 8]
java: [11, 8, 14]

steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/[email protected]
with:
java-version: ${{ matrix.java }}

- uses: actions/[email protected]
- name: Pull Maven Cache
uses: actions/[email protected]
id: maven-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- uses: s4u/[email protected]
name: Use ${{ matrix.java }} as the java target
with:
properties: '[{"maven.compiler.target": "${{ matrix.java }}"}]'
- name: Setup YAPFA Project
run: |
git submodule update --init --recursive -f
git config --global user.email "[email protected]"
git config --global user.name "Github CI"
sudo chmod -R -f 777 scripts
- name: Build Maven Depends
if: steps.maven-cache.outputs.cache-hit != 'true'
run: |
cd Tuinity
./tuinity jar
cd ..//
- name: Build YAPFA
run: |
git submodule init
git submodule update --init --recursive
git config --global user.email "[email protected]"
git config --global user.name "Github CI"
yapfaDir=`pwd`
./patchPaper.sh
cd Tuinity
mvn -N install
./tuinity patch
cd $yapfaDir
./yapfa patch
./yapfa build
./yapfa paperclip
./yapfa full
- name: Upload Artifact
uses: actions/upload-artifact@v2-preview
with:
name: YAPFA-${{ matrix.java }}
path: yapfa-paperclip.jar
path: target/YAPFA-1.16.1-paperclip.jar
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ mc-dev
.project
.idea
yapfa-paperclip.jar

target/site/surefire-report.html
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "Tuinity"]
path = Tuinity
url = https://github.com/Spottedleaf/Tuinity
url = https://github.com/tsao-chi/Tuinity-autoupstreamupdate.git
branch = ver/1.16
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ This Fork tries to import universal/performance patches from [EMC](https://githu
Run the following commands in the root directory:

```
git submodule init
git submodule update
./fetchUpstream.sh
./yapfa build
./yapfa paperclip
git submodule update --init --recursive --force
./yapfa jar
```

## LICENSE
Expand All @@ -61,4 +58,4 @@ Everything is licensed under the MIT license, and is free to be used in your own
See [EMC](https://github.com/starlis/empirecraft), [Lithium](https://github.com/jellysquid3/lithium-fabric), [Akarin](https://github.com/Akarin-project/Akarin), [Purpur](https://github.com/pl3xgaming/Purpur) and [Tuinity](https://github.com/Spottedleaf/Tuinity)
for the license of material used/modified by this project.

**By using this project you accept the Mojang EULA! Starting the server-jar requires that you have read and accepted the EULA because of [this patch](https://github.com/tr7zw/YAPFA/blob/master/patches/server/0017-EMC-Accept-the-EULA.patch)!**
**By using this project you accept the Mojang EULA! Starting the server-jar requires that you have read and accepted the EULA because of [this patch](https://github.com/tr7zw/YAPFA/blob/master/patches/server/0017-EMC-Accept-the-EULA.patch)!**
2 changes: 1 addition & 1 deletion Tuinity
2 changes: 1 addition & 1 deletion current-tuinity
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.2--055421230a1bb70eefcf15d57ad8551e1e9d47b1
1.16.1--8c602452d2ded22cb7322c41de5c78395b5f1348
12 changes: 0 additions & 12 deletions fetchUpstream.sh

This file was deleted.

1 change: 0 additions & 1 deletion patchPaper.sh

This file was deleted.

79 changes: 0 additions & 79 deletions scripts/apply.sh

This file was deleted.

95 changes: 95 additions & 0 deletions scripts/applyPatches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/env bash

# SCRIPT HEADER start
basedir=$1
source "$basedir/scripts/functions.sh"
echo " "
echo "----------------------------------------"
echo " $(bashcolor 1 32)Task$(bashcolorend) - Apply Patches"
echo " This will apply all of YAPFA patches on top of the Paper."
echo " "
echo " $(bashcolor 1 32)Subtask:$(bashcolorend)"
echo " - Import Sources"
echo " "
echo " $(bashcolor 1 32)Modules:$(bashcolorend)"
echo " - $(bashcolor 1 32)1$(bashcolorend) : API"
echo " - $(bashcolor 1 32)2$(bashcolorend) : Server"
echo "----------------------------------------"
# SCRIPT HEADER end

needimport=$2

function applyPatch {
baseproject=$1
basename=$(basename $baseproject)
target=$2
branch=$3
patch_folder=$4

# Skip if that software have no patch
haspatch=-f "$basedir/patches/$patch_folder/"*.patch >/dev/null 2>&1 # too many files
if [ ! haspatch ]; then
echo " $(bashcolor 1 33)($5/$6) Skipped$(bashcolorend) - No patch found for $target under patches/$patch_folder"
return
fi

echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Setup upstream project.."
cd "$basedir/$baseproject"
$gitcmd fetch --all &> /dev/null
# Create the upstream branch in Paper project with current state
$gitcmd checkout master >/dev/null 2>&1 # possibly already in
$gitcmd branch -D upstream &> /dev/null
$gitcmd branch -f upstream "$branch" &> /dev/null && $gitcmd checkout upstream &> /dev/null

if [[ $needimport != "1" ]]; then
if [ $baseproject != "Paper/Paper-API" ]; then
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.."
basedir && $scriptdir/importSources.sh $basedir 1 || exit 1
fi
fi

basedir
# Create source project dirs
if [ ! -d "$basedir/$target" ]; then
mkdir "$basedir/$target"
cd "$basedir/$target"
# $gitcmd remote add origin "$5"
fi
cd "$basedir/$target"
$gitcmd init > /dev/null 2>&1

echo " "
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Reset $target to $basename.."
# Add the generated Paper project as the upstream remote of subproject
$gitcmd remote rm upstream &> /dev/null
$gitcmd remote add upstream "$basedir/$baseproject" &> /dev/null
# Ensure that we are in the branch we want so not overriding things
$gitcmd checkout master &> /dev/null || $gitcmd checkout -b master &> /dev/null
$gitcmd fetch upstream &> /dev/null
# Reset our source project to Paper
cd "$basedir/$target" && $gitcmd reset --hard upstream/upstream &> /dev/null
echo " "

echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Apply patches to $target.."
# Abort previous applying operation
$gitcmd am --abort >/dev/null 2>&1
# Apply our patches on top Paper in our dirs
$gitcmd am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch

if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
echo " Please review above details and finish the apply then"
echo " save the changes with rebuildPatches.sh"
echo " or use 'git am --abort' to cancel this applying."
echo " $(bashcolor 1 33)($5/$6) Suspended$(bashcolorend) - Resolve the conflict or abort the apply"
echo " "
cd "$basedir/$target"
exit 1
else
echo " $(bashcolor 1 32)($6/$6) Succeed$(bashcolorend) - Patches applied cleanly to $target"
echo " "
fi
}

(applyPatch Tuinity/Tuinity-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 &&
applyPatch Tuinity/Tuinity-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2) || exit 1
30 changes: 30 additions & 0 deletions scripts/commitUpstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

echo "[YAPFA] State: Commit Upstream"

(
set -e

function changeLog() {
base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1)
cd $1 && git log --oneline ${base}...HEAD
}
paper=$(changeLog Tuinity)

updated=""
logsuffix=""
if [ ! -z "$paper" ]; then
logsuffix="$logsuffix\nTuinity Changes:\n$paper"
if [ -z "$updated" ]; then updated="Tuinity"; else updated="$updated/Tuinity"; fi
fi
disclaimer="Upstream has released updates that appears to apply and compile correctly"

if [ ! -z "$1" ]; then
disclaimer="$@"
fi

log="Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"

echo -e "$log" | git commit -F -

) || exit 1
16 changes: 0 additions & 16 deletions scripts/commitup.sh

This file was deleted.

8 changes: 8 additions & 0 deletions scripts/fetchUpstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
cd $1
cd Tuinity
git clean -fx
git clean -fd
git fetch
git reset --hard origin/ver/1.16
git submodule update --init --recursive -f
Loading