diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3abff5..59c9c5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,24 +10,43 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: | + - name: Install dependencies and build + run: | npm i npm run build - # Make sure the action works on a clean machine without building + # Make sure the action works on a clean machine without building it run: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: ./ + + - name: Compile 2 spigot version + uses: ./ with: versions: latest, 1.8 + # Run again. The Action should detect that the requested versions are already inside the local maven repo + - name: Compile the same versions agains + uses: ./ + with: + # These versions should match the ones above + versions: latest, 1.8 + + - name: Upload logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: logs + path: /tmp/SpraxDev-Action-SpigotMC/logs/ + # Run the original BuildTools in GitHub Actions to easily compare the build times etc. original-run: runs-on: ubuntu-latest steps: - name: Run original Spigot-BuildTools + # These versions should match the ones from the 'run'-job + # Using '--compile Spigot' as this action does the same by default run: | wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -O BuildTools.jar java -jar BuildTools.jar --rev latest --compile Spigot diff --git a/README.md b/README.md index 2783799..e64f5a1 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,14 @@
-# Action-Spigot -This Action allows you to easily compile Minecraft Spigot +# Action-SpigotMC +This Action allows you to easily compile Minecraft Spigot or Paper and install it in your runners local maven repository. +Supported: +* SpigotMC (using official BuildTools or my modified one) +* ~~PaperMC~~ (coming soon #26) + You configure all the versions you want, and it'll compile all the missing versions automatically. By checking for a file in the local maven repository beforehand, build times can be reduces drastically. @@ -37,7 +41,7 @@ If you don't change them, you can remove them from your workflow, as they are set automatically. ```YAML -- uses: SpraxDev/Action-Spigot@v1 +- uses: SpraxDev/Action-SpigotMC@v1 with: # A comma-separated list of Spigot version that should be compiled # These values are later given to the BuildTools.jar as '--rev' argument @@ -45,13 +49,6 @@ as they are set automatically. # Example: latest, 1.14.4, 1.8.8 versions: latest - # A comma-separated list of build targets - # This value is later given to the BuildTools.jar as '--compile' argument - # - # Available: None, Spigot, CraftBukkit - # Example: Spigot, CraftBukkit - target: Spigot - # Should sources be generated? # If enabled, BuildTools is provided the '--generate-source' argument generateSrc: false @@ -72,4 +69,9 @@ as they are set automatically. # The amount of builds allowed to run at the same time # Set to '-1' to use system's cpu core count threads: -1 + + # You can choose between different BuildTools to be used by this action + # 'SpraxDev' is my fork of SpigotMC's that introduces some changes (https://github.com/SpraxDev/Spigot-BuildTools/#breaking-changes) + # Available: SpraxDev, SpigotMC + buildToolProvider: SpraxDev ``` \ No newline at end of file diff --git a/action.yml b/action.yml index 4a74e32..8a3c078 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ -name: Compile Minecraft Spigot (BuildTools) -description: Makes it easier to compile multiple Spigot versions at the same time and speed up clean builds +name: Compile Minecraft Spigot or Paper (BuildTools) +description: Makes it easier to compile multiple Spigot/Paper versions at the same time and speed up clean builds author: Christian Koop branding: @@ -11,10 +11,6 @@ inputs: required: false default: latest description: Versions to build (sperate multiple with ',') - target: - required: false - default: Spigot - description: Select what exactly you want to compile (none, Spigot, CraftBukkit) (sperate multiple with ',') generateSrc: required: false default: 'false' @@ -35,6 +31,10 @@ inputs: required: false default: '-1' description: The amount of builds allowed to run at a time, set to '-1' to use system's cpu count + buildToolProvider: + required: false + default: SpraxDev + description: Whose BuildTool should be used? (SpraxDev [default], SpigotMC) runs: using: node12 diff --git a/dist/index.js b/dist/index.js index 61c5e92..8e506ba 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -require('./sourcemap-register.js');module.exports=(()=>{var e={7351:function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(Object.hasOwnProperty.call(e,r))t[r]=e[r];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const i=n(r(2087));const o=r(5278);function issueCommand(e,t,r){const n=new Command(e,t,r);process.stdout.write(n.toString()+i.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const c="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=c+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}e+=`${c}${escapeData(this.message)}`;return e}}function escapeData(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r(function(t){t(e)})}return new(r||(r=Promise))(function(r,i){function fulfilled(e){try{step(n.next(e))}catch(e){i(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){i(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(Object.hasOwnProperty.call(e,r))t[r]=e[r];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const o=r(7351);const c=r(717);const s=r(5278);const a=i(r(2087));const u=i(r(5622));var f;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(f=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=s.toCommandValue(t);process.env[e]=r;const n=process.env["GITHUB_ENV"]||"";if(n){const t="_GitHubActionsFileCommandDelimeter_";const n=`${e}<<${t}${a.EOL}${r}${a.EOL}${t}`;c.issueCommand("ENV",n)}else{o.issueCommand("set-env",{name:e},r)}}t.exportVariable=exportVariable;function setSecret(e){o.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){c.issueCommand("PATH",e)}else{o.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}return r.trim()}t.getInput=getInput;function setOutput(e,t){o.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){o.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=f.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){o.issueCommand("debug",{},e)}t.debug=debug;function error(e){o.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){o.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+a.EOL)}t.info=info;function startGroup(e){o.issue("group",e)}t.startGroup=startGroup;function endGroup(){o.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return n(this,void 0,void 0,function*(){startGroup(e);let r;try{r=yield t()}finally{endGroup()}return r})}t.group=group;function saveState(e,t){o.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}t.getState=getState},717:function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(Object.hasOwnProperty.call(e,r))t[r]=e[r];t["default"]=e;return t};Object.defineProperty(t,"__esModule",{value:true});const i=n(r(5747));const o=n(r(2087));const c=r(5278);function issueCommand(e,t){const r=process.env[`GITHUB_${e}`];if(!r){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!i.existsSync(r)){throw new Error(`Missing file at path: ${r}`)}i.appendFileSync(r,`${c.toCommandValue(t)}${o.EOL}`,{encoding:"utf8"})}t.issueCommand=issueCommand},5278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}t.toCommandValue=toCommandValue},5768:(e,t,r)=>{e.exports=r(6196)().Promise},4549:e=>{"use strict";var t="@@any-promise/REGISTRATION",r=null;e.exports=function(e,n){return function register(i,o){i=i||null;o=o||{};var c=o.global!==false;if(r===null&&c){r=e[t]||null}if(r!==null&&i!==null&&r.implementation!==i){throw new Error('any-promise already defined as "'+r.implementation+'". You can only register an implementation before the first '+' call to require("any-promise") and an implementation cannot be changed')}if(r===null){if(i!==null&&typeof o.Promise!=="undefined"){r={Promise:o.Promise,implementation:i}}else{r=n(i)}if(c){e[t]=r}}return r}}},6196:(e,t,r)=>{"use strict";e.exports=r(4549)(global,loadImplementation);function loadImplementation(e){var t=null;if(shouldPreferGlobalPromise(e)){t={Promise:global.Promise,implementation:"global.Promise"}}else if(e){var r=require(e);t={Promise:r.Promise||r,implementation:e}}else{t=tryAutoDetect()}if(t===null){throw new Error("Cannot find any-promise implementation nor"+" global.Promise. You must install polyfill or call"+' require("any-promise/register") with your preferred'+' implementation, e.g. require("any-promise/register/bluebird")'+' on application load prior to any require("any-promise").')}return t}function shouldPreferGlobalPromise(e){if(e){return e==="global.Promise"}else if(typeof global.Promise!=="undefined"){var t=/v(\d+)\.(\d+)\.(\d+)/.exec(process.version);return!(t&&+t[1]==0&&+t[2]<12)}return false}function tryAutoDetect(){var e=["es6-promise","promise","native-promise-only","bluebird","rsvp","when","q","pinkie","lie","vow"];var t=0,r=e.length;for(;t