diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index aeecd407..e9eb59d2 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -26,38 +26,53 @@ jobs: - java11 - java11-openj9 include: + # JAVA 17: - variant: java17 + baseImage: eclipse-temurin:17-jre + platforms: linux/amd64,linux/arm/v7,linux/arm64 + mcVersion: LATEST + - variant: java17-jdk baseImage: eclipse-temurin:17 platforms: linux/amd64,linux/arm/v7,linux/arm64 mcVersion: LATEST - variant: java17-openj9 - baseImage: ibm-semeru-runtimes:open-17-jdk + baseImage: ibm-semeru-runtimes:open-17-jre platforms: linux/amd64,linux/arm64 mcVersion: LATEST - variant: java17-alpine - baseImage: eclipse-temurin:17-jdk-alpine + baseImage: eclipse-temurin:17-jre-alpine platforms: linux/amd64 mcVersion: LATEST + # JAVA 11: + - variant: java11 + baseImage: adoptopenjdk:11-jre-hotspot + platforms: linux/amd64,linux/arm/v7,linux/arm64 + mcVersion: 1.16.5 + - variant: java11-jdk + baseImage: adoptopenjdk:11-jdk-hotspot + platforms: linux/amd64,linux/arm/v7,linux/arm64 + mcVersion: 1.16.5 + - variant: java11-openj9 + baseImage: ibm-semeru-runtimes:open-11-jre + platforms: linux/amd64,linux/arm64 + mcVersion: 1.16.5 + # JAVA 8: NOTE: Unable to go past 8u312 because of Forge https://github.com/MultiMC/Launcher/issues/447 - variant: java8 - baseImage: openjdk:8-jdk-alpine3.8 + baseImage: openjdk:8-jre-alpine3.9 platforms: linux/amd64 mcVersion: 1.12.2 - variant: java8-multiarch baseImage: eclipse-temurin:8u312-b07-jre platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - - variant: java8-openj9 - baseImage: ibm-semeru-runtimes:open-8-jdk + - variant: java8-jdk + baseImage: eclipse-temurin:8u312-b07-jdk platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - - variant: java11 - baseImage: adoptopenjdk:11-jdk-hotspot - platforms: linux/amd64,linux/arm/v7,linux/arm64 - mcVersion: 1.16.5 - - variant: java11-openj9 - baseImage: ibm-semeru-runtimes:open-11-jdk + - variant: java8-openj9 + baseImage: ibm-semeru-runtimes:open-8u312-b07-jre platforms: linux/amd64,linux/arm64 - mcVersion: 1.16.5 + mcVersion: 1.12.2 env: IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }} runs-on: ubuntu-20.04 @@ -115,6 +130,7 @@ jobs: - name: Run tests env: MINECRAFT_VERSION: ${{ matrix.mcVersion }} + VARIANT: ${{ matrix.variant }} MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }} run: | tests/test.sh diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index fd9db8eb..c34f9324 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -23,10 +23,17 @@ $env:IMAGE_TO_TEST="mc-dev" docker build -t $env:IMAGE_TO_TEST . pushd "tests/setuponlytests/$env:FOLDER_TO_TEST/" docker-compose run mc -docker-compose down --remove-orphans +docker-compose down -v --remove-orphans popd ``` +PowerShell: Building different images of Java for testing +```powershell +$env:BASE_IMAGE='eclipse-temurin:8u312-b07-jre' +$env:IMAGE_TO_TEST="mc-dev" +docker build --build-arg BASE_IMAGE=$env:BASE_IMAGE -t $env:IMAGE_TO_TEST . +``` + Bash: (Example of building and testing ForgeAPI) ```bash export MODS_FORGEAPI_KEY='$2a$...' @@ -35,7 +42,7 @@ export IMAGE_TO_TEST="mc-dev" docker build -t $IMAGE_TO_TEST . pushd tests/setuponlytests/$FOLDER_TO_TEST/ docker-compose run mc -docker-compose down --remove-orphans +docker-compose down -v --remove-orphans popd ``` diff --git a/scripts/start-setupForgeApiMods b/scripts/start-setupForgeApiMods index 3db79700..21bf9e75 100644 --- a/scripts/start-setupForgeApiMods +++ b/scripts/start-setupForgeApiMods @@ -159,13 +159,15 @@ downloadModPackfromModFile() { fi # grabs needed values from our json return + unset file_name + unset download_url file_name=$(jq -n "$PROJECT_FILE" | jq -jc '.fileName' ) download_url=$(jq -n "$PROJECT_FILE" | jq -jc '.downloadUrl' ) # trys to make the output directory incase it doesnt exist. mkdir -p "$out_dir" echo "Downloading ${download_url}" - if ! get --skip-up-to-date -o "${out_dir}/${file_name}" $download_url ; then + if ! get --skip-up-to-date -o "${out_dir}/${file_name}" "${download_url}"; then log "ERROR: failed to download from ${download_url}" exit 2 fi @@ -179,25 +181,6 @@ downloadDependencies(){ if [ "$required_dependencies" ]; then jq -n "$required_dependencies" | jq -c '.[]?' | while read current_dependency; do mod_id=$(jq -n "$current_dependency" | jq -jc '.modId' ) - - # BROKEN: Example Voice mod keeps returning the voice mod file id instead of the mod file id. - # file_id=$(jq -n "$current_dependency" | jq -jc '.fileId' ) - # dependency_data=$(curl -X GET -s \ - # "${FORGEAPI_BASE_URL}/mods/${mod_id}/files/${file_id}/download-url" \ - # -H 'Accept: application/json' -H 'x-api-key: '${MODS_FORGEAPI_KEY}'') - # if [ ! "$dependency_data" ]; then - # log "ERROR: unable to retrieve dependency data files for ${project_id} from ForgeAPI" - # exit 2 - # fi - # dependency_download_url=$(jq -n "$dependency_data" | jq -jc '.data' ) - # echo "Downloading dependency ${dependency_download_url}" - # if ! get -o "${out_dir}/" $dependency_download_url ; then - # log "ERROR: failed to download dependency from ${dependency_download_url}" - # exit 2 - # fi - - # Using current mod path and release to go get the REQUIRED DEPENDENCY - # NOTE: we are ASUMING it will be release. modFileByProjectID $mod_id "release" downloadModPackfromModFile done diff --git a/tests/setuponlytests/curseforge/docker-compose.yml b/tests/setuponlytests/curseforge/docker-compose.yml new file mode 100644 index 00000000..ddc330c2 --- /dev/null +++ b/tests/setuponlytests/curseforge/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3" + +services: + mc: + image: ${IMAGE_TO_TEST:-itzg/minecraft-server:java8-multiarch} + environment: + EULA: "true" + SETUP_ONLY: "TRUE" + TYPE: CURSEFORGE + CF_SERVER_MOD: /modpacks/pack.zip + INIT_MEMORY: 2G + MAX_MEMORY: 6G + volumes: + - ./data:/data + - ./modpacks:/modpacks:ro + diff --git a/tests/setuponlytests/curseforge/modpacks/pack.zip b/tests/setuponlytests/curseforge/modpacks/pack.zip new file mode 100644 index 00000000..2319ec9b Binary files /dev/null and b/tests/setuponlytests/curseforge/modpacks/pack.zip differ diff --git a/tests/setuponlytests/curseforge/require.sh b/tests/setuponlytests/curseforge/require.sh new file mode 100644 index 00000000..9aefb58c --- /dev/null +++ b/tests/setuponlytests/curseforge/require.sh @@ -0,0 +1 @@ +[[ $VARIANT == java8* ]] || exit 1 diff --git a/tests/setuponlytests/curseforge/verify.sh b/tests/setuponlytests/curseforge/verify.sh new file mode 100644 index 00000000..7b985029 --- /dev/null +++ b/tests/setuponlytests/curseforge/verify.sh @@ -0,0 +1,2 @@ +mc-image-helper assert fileExists "/data/FeedTheBeast/forge-installer.jar" +mc-image-helper assert fileExists "/data/FeedTheBeast/forge.jar" diff --git a/tests/setuponlytests/forgeapimods_file/require.sh b/tests/setuponlytests/forgeapimods_file/require.sh index 2fd503da..4b9579f3 100644 --- a/tests/setuponlytests/forgeapimods_file/require.sh +++ b/tests/setuponlytests/forgeapimods_file/require.sh @@ -1 +1,2 @@ -[[ $MODS_FORGEAPI_KEY ]] || exit 1 \ No newline at end of file +[[ $MINECRAFT_VERSION == LATEST ]] || exit 1 +[[ $MODS_FORGEAPI_KEY ]] || exit 1 diff --git a/tests/setuponlytests/forgeapimods_gametype/require.sh b/tests/setuponlytests/forgeapimods_gametype/require.sh index 2fd503da..4b9579f3 100644 --- a/tests/setuponlytests/forgeapimods_gametype/require.sh +++ b/tests/setuponlytests/forgeapimods_gametype/require.sh @@ -1 +1,2 @@ -[[ $MODS_FORGEAPI_KEY ]] || exit 1 \ No newline at end of file +[[ $MINECRAFT_VERSION == LATEST ]] || exit 1 +[[ $MODS_FORGEAPI_KEY ]] || exit 1 diff --git a/tests/setuponlytests/forgeapimods_projectids/require.sh b/tests/setuponlytests/forgeapimods_projectids/require.sh index 2fd503da..4b9579f3 100644 --- a/tests/setuponlytests/forgeapimods_projectids/require.sh +++ b/tests/setuponlytests/forgeapimods_projectids/require.sh @@ -1 +1,2 @@ -[[ $MODS_FORGEAPI_KEY ]] || exit 1 \ No newline at end of file +[[ $MINECRAFT_VERSION == LATEST ]] || exit 1 +[[ $MODS_FORGEAPI_KEY ]] || exit 1