From cfd7aeb927d0816a0d7943f370334ec6a876f16c Mon Sep 17 00:00:00 2001 From: Kas-tle <26531652+Kas-tle@users.noreply.github.com> Date: Fri, 17 Feb 2023 11:37:01 -0800 Subject: [PATCH] Update PR Build Action for API (#3535) * Use API from use making PR if exists * Update CONTRIBUTING.md * Address @Tim203's review * Fix path * Build the api before doing anything with the Geyser repo --------- Co-authored-by: Tim203 --- .github/workflows/pullrequest.yml | 41 ++++++++++++++++++++++++------- CONTRIBUTING.md | 4 ++- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 39e9fe188..6781d7483 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -4,21 +4,44 @@ on: [pull_request] jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - name: Set up JDK 17 uses: actions/setup-java@v1 with: - distribution: 'temurin' java-version: 17 - cache: 'gradle' - - name: submodules-init - uses: snickerbockers/submodules-init@v4 - - name: Build with Gradle - run: ./gradlew build + distribution: temurin + cache: gradle + + - name: Check if the author has forked the API repo + uses: Kas-tle/ForkFinder@v1.0.1 + id: find_forks + with: + owner: GeyserMC + repo: api + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Use author's API repo if it exists + if: steps.find_forks.outputs.target_branch_found == 'true' + env: + API_FORK_URL: ${{ steps.find_forks.outputs.user_fork_url }} + API_FORK_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + git clone "${API_FORK_URL}" --single-branch --branch "${API_FORK_BRANCH}" api + cd api + ./gradlew publishToMavenLocal + + - name: Checkout repository and submodules + uses: actions/checkout@v3 + with: + submodules: recursive + path: geyser + + - name: Build Geyser + uses: gradle/gradle-build-action@v2 + with: + arguments: build + build-root-directory: geyser - name: Archive artifacts (Geyser Fabric) uses: actions/upload-artifact@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ce6894845..dac8a9a07 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,4 +48,6 @@ Make sure to comment your code where possible. The nature of our software requires a lot of arrays and maps to be stored - where possible, use Fastutil's specialized maps. For example, if you're storing block state translations, use an `Int2IntMap`. -We have a rundown of all the tools you need to develop over on our [wiki](https://github.com/GeyserMC/Geyser/wiki/Developer-Guide). If you have any questions, please feel free to reach out to our [Discord](https://discord.gg/geysermc)! +We have a rundown of all the tools you need to develop over on our [wiki](https://wiki.geysermc.org/other/developer-guide/). If you have any questions, please feel free to reach out to our [Discord](https://discord.gg/geysermc)! + +If you're making a pull request that also depends on changes to [the base API](https://github.com/GeyserMC/api), simply fork the API repo and create a branch with the same name as your Geyser PR. The pull request [action](https://github.com/GeyserMC/Geyser/blob/master/.github/workflows/pullrequest.yml) will automatically use your API changes while building your changes to Geyser. \ No newline at end of file