Skip to content

feat: added fabric support #1

feat: added fabric support

feat: added fabric support #1

Workflow file for this run

name: E2E Tests

Check failure on line 1 in .github/workflows/e2e.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/e2e.yml

Invalid workflow file

(Line: 121, Col: 14): Unexpected symbol: '|'. Located at position 19 within expression: matrix.mc_version | replace('.', '_')
permissions:
contents: read
on:
pull_request:
push:
branches:
- master
workflow_dispatch: # Allow manual triggering
jobs:
e2e:
runs-on: ubuntu-latest
name: E2E - Fabric-${{ matrix.mc_version }}
strategy:
fail-fast: false
matrix:
include:
# Fabric 1.20.1 (legacy modded, Java 17)
- mc_version: "1.20.1"
java_image: "java17"
fabric_loader: "0.16.10"
# Fabric 1.21.1 (stable 1.21, Java 21)
- mc_version: "1.21.1"
java_image: "java21"
fabric_loader: "0.16.9"
# Fabric 1.21.4 (current latest, Java 21)
- mc_version: "1.21.4"
java_image: "java21"
fabric_loader: "0.16.9"
steps:
- uses: actions/checkout@v4
# Checkout BanManager for building the Fabric mod
- uses: actions/checkout@v4
with:
repository: BanManagement/BanManager
path: BanManager
ref: master
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "temurin"
# Also set up JDK 17 for Fabric 1.20.x builds
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
# Ensure JDK 21 is the default
- name: Set JDK 21 as default
run: echo "JAVA_HOME=$JAVA_HOME_21_X64" >> $GITHUB_ENV
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
- uses: actions/cache@v4
with:
path: |
.gradle/loom-cache
key: ${{ runner.os }}-loom-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-loom-
# Docker Buildx for better caching
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Cache Docker layers for test runner image
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-e2e-${{ hashFiles('e2e/Dockerfile.tests', 'e2e/tests/package*.json') }}
restore-keys: |
${{ runner.os }}-docker-e2e-
# Pre-build the test runner image with cache
- name: Build test runner image
uses: docker/build-push-action@v5
with:
context: e2e
file: e2e/Dockerfile.tests
push: false
load: true
tags: e2e-tests:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# Move cache to avoid ever-growing cache
- name: Move Docker cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# Build BanManager dependencies and publish to mavenLocal
- name: Publish BanManager to mavenLocal
working-directory: BanManager
run: |
./gradlew :BanManagerCommon:publishToMavenLocal :BanManagerLibs:publishToMavenLocal \
:fabric:${{ matrix.mc_version }}:publishToMavenLocal --build-cache
# Build BanManager Fabric plugin
- name: Build BanManager Fabric
working-directory: BanManager
run: ./gradlew :fabric:${{ matrix.mc_version }}:remapJar --build-cache
# Build WebEnhancer Fabric plugin
- name: Build WebEnhancer Fabric
run: ./gradlew :fabric:${{ matrix.mc_version }}:remapJar --build-cache
- name: Run E2E tests
run: ./gradlew :BanManagerWebEnhancerE2E:testFabric_${{ matrix.mc_version | replace('.', '_') }}
timeout-minutes: 15
env:
MC_VERSION: ${{ matrix.mc_version }}
JAVA_IMAGE: ${{ matrix.java_image }}
FABRIC_LOADER: ${{ matrix.fabric_loader }}
- name: Collect logs on failure
if: failure()
working-directory: e2e/platforms/fabric
run: |
docker compose logs > ../../e2e-logs-${{ matrix.mc_version }}.txt 2>&1 || true
env:
MC_VERSION: ${{ matrix.mc_version }}
JAVA_IMAGE: ${{ matrix.java_image }}
FABRIC_LOADER: ${{ matrix.fabric_loader }}
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-logs-${{ matrix.mc_version }}
path: e2e-logs-${{ matrix.mc_version }}.txt
retention-days: 7
- name: Cleanup
if: always()
working-directory: e2e/platforms/fabric
run: docker compose down -v || true
env:
MC_VERSION: ${{ matrix.mc_version }}
JAVA_IMAGE: ${{ matrix.java_image }}
FABRIC_LOADER: ${{ matrix.fabric_loader }}