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

E2E testing #3884

Merged
merged 10 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
71 changes: 71 additions & 0 deletions .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: End to End Testing
J3fftw1 marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_call:
inputs:
artifact-name:
description: 'Slimefun artifact name'
J3fftw1 marked this conversation as resolved.
Show resolved Hide resolved
required: true
type: string

jobs:
e2e-testing:
name: End to End Testing
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
matrix:
include:
- mcVersion: '1.16.5'
javaVersion: '16'
- mcVersion: '1.17.1'
javaVersion: '17'
- mcVersion: '1.18.2'
javaVersion: '18'
- mcVersion: '1.19.4'
javaVersion: '19'
- mcVersion: '1.20.1'
javaVersion: '20'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/[email protected]
with:
distribution: temurin
java-version: ${{ matrix.javaVersion }}
java-package: jdk
architecture: x64

- name: Setup server
run: |
echo 'eula=true' > eula.txt
mkdir plugins

- name: Download ${{ matrix.mcVersion }} Paper
run: |
VERSION="${{ matrix.mcVersion }}"
BUILD_JAR=$(curl -s "https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds" \
| jq '.builds[-1] | "\(.build) \(.downloads.application.name)"' -r)
BUILD=$(echo "$BUILD_JAR" | awk '{print $1}')
JAR_FILE=$(echo "$BUILD_JAR" | awk '{print $2}')
curl -o paper.jar \
"https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$BUILD/downloads/$JAR_FILE"

- name: Download Slimefun
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: plugins/

- name: Download e2e-tester
run: |
curl -o e2e-tester.jar https://preview-builds.walshy.dev/download/e2e-tester/main/latest
mv e2e-tester.jar plugins/e2e-tester.jar

- name: Run server
run: |
java -jar paper.jar --nogui
J3fftw1 marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 11 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
setup-preview-build:
name: Preview build
runs-on: ubuntu-latest
outputs:
short-commit-hash: ${{ steps.env-setup.outputs.SHORT_COMMIT_HASH }}

steps:
- name: Checkout repository
Expand All @@ -35,10 +37,12 @@ jobs:
restore-keys: ${{ runner.os }}-m2

# Setup for the preview build
- run: |
- id: env-setup
run: |
SHORT_COMMIT_HASH=$(git rev-parse --short=8 ${{ github.sha }})
JAR_VERSION="Preview Build #${{ github.event.number }}-$SHORT_COMMIT_HASH"
echo "SHORT_COMMIT_HASH=$SHORT_COMMIT_HASH" >> "$GITHUB_ENV"
echo "SHORT_COMMIT_HASH=$SHORT_COMMIT_HASH" >> "$GITHUB_OUTPUT"
echo "JAR_VERSION=$JAR_VERSION" >> "$GITHUB_ENV"
sed -i "s/<version>4.9-UNOFFICIAL<\/version>/<version>$JAR_VERSION<\/version>/g" pom.xml

Expand All @@ -50,3 +54,9 @@ jobs:
with:
name: slimefun-${{ github.event.number }}-${{ env.SHORT_COMMIT_HASH }}
path: 'target/Slimefun v${{ env.JAR_VERSION }}.jar'

call-workflows:
needs: [setup-preview-build]
uses: ./.github/workflows/e2e-testing.yml
with:
artifact-name: slimefun-${{ github.event.number }}-${{ needs.setup-preview-build.outputs.short-commit-hash }}