Skip to content

Commit

Permalink
revamped ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysdh540 committed Oct 16, 2023
1 parent 7e8a22d commit d5e047c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 136 deletions.
167 changes: 36 additions & 131 deletions .github/workflows/build-multiver.yml
Original file line number Diff line number Diff line change
@@ -1,163 +1,68 @@
name: build (multiversion branch)
name: build
on: [ pull_request, push ]

jobs:
webhook-message:
build:
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: get_branch
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT

- name: send building message to discord
if: "!startsWith(github.event.head_commit.message, '[skip]')"
uses: realRobotix/action-discord-notifier@release-master
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
message-title: Building mod from branch ${{ steps.get_branch.outputs.branch }}

- name: send not building message to discord
if: "startsWith(github.event.head_commit.message, '[skip]')"
uses: realRobotix/action-discord-notifier@release-master
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
message-title: Build skipped for branch ${{ steps.get_branch.outputs.branch }}


build_1_19:
if: "!startsWith(github.event.head_commit.message, '[skip]')"
if: !startsWith(github.event.head_commit.message, '[skip]')
strategy:
matrix:
java: [ 17 ]
runs-on: ubuntu-latest
steps:
- name: steal code from repository
uses: actions/checkout@v3

- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: zulu
cache: gradle

- name: cache gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle

- name: give gradle permission to murder github servers
run: chmod +x ./gradlew

- name: gradle murders github servers
run: ./gradlew assemble -PmcVer="1.19.2"

- name: upload forge build artifacts
uses: actions/upload-artifact@v3
with:
name: cu-artifacts-forge-1.19.2
path: forge/build/libs/*.jar

- name: upload fabric build artifacts
uses: actions/upload-artifact@v3
with:
name: cu-artifacts-fabric-1.19.2
path: fabric/build/libs/*.jar

- name: upload merged build artifact to github
uses: actions/upload-artifact@v3
with:
name: cu-artifacts-merged-1.19.2
path: |
build/libs/merged/*.jar
- name: upload merged build artifact to discord
if: success()
uses: sinshutu/upload-to-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: build/libs/merged/*.jar

- name: send build failure message to discord
if: failure()
uses: ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- name: send skipped message
uses: appleboy/discord-action@v1.0.0
with:
args: 'Build failed for 1.19.2!'


build_1_20:
if: "!startsWith(github.event.head_commit.message, '[skip]')"
strategy:
matrix:
java: [ 17 ]
runs-on: ubuntu-latest
steps:

- name: steal code from repository
webhook_id: ${{ secrets.WEBHOOK_ID }}
webhook_token: ${{ secrets.WEBHOOK_TOKEN }}
args: '# Build #${{ github.run_number }} skipped'
- name: checkout
uses: actions/checkout@v3

- name: setup jdk ${{ matrix.java }}
- name: install java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: zulu
cache: gradle

- name: cache gradle
- name: cache loom
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
path: ~/.gradle/loom-cache
key: loom-cache-${{ runner.os }}-gradle-${{ hashFiles('~/.gradle/loom-cache/**') }}
restore-keys: ${{ runner.os }}-gradle

- name: give gradle permission to murder github servers
run: chmod +x ./gradlew

- name: gradle murders github servers
run: ./gradlew assemble -PmcVer="1.20.1"
- name: give scripts execution permissions
run: chmod +x gradlew buildAll

- name: upload forge build artifacts
uses: actions/upload-artifact@v3
with:
name: cu-artifacts-forge-1.20.1
path: forge/build/libs/*.jar
- name: Run build script
run: ./buildAll

- name: upload fabric build artifacts
uses: actions/upload-artifact@v3
with:
name: cu-artifacts-fabric-1.20.1
path: fabric/build/libs/*.jar
- name: upload non-merged artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: ./artifacts/**

- name: upload merged build artifact to github
- name: upload merged artifacts
uses: actions/upload-artifact@v3
with:
name: cu-artifacts-merged-1.20.1
path: |
build/libs/merged/*.jar
name: merged-artifacts
path: ./build/libs/merged/*.jar

- name: upload merged build artifact to discord
- name: send artifacts to webhook
if: success()
uses: sinshutu/upload-to-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: appleboy/discord-action@v1.0.0
with:
args: build/libs/merged/*.jar
webhook_id: ${{ secrets.WEBHOOK_ID }}
webhook_token: ${{ secrets.WEBHOOK_TOKEN }}
args: '# Build #${{ github.run_number }}'
file: build/libs/merged/*.jar

- name: send build failure message to discord
- name: send failure message
if: failure()
uses: ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: appleboy/discord-action@v1.0.0
with:
args: 'Build failed for 1.20.1!'
webhook_id: ${{ secrets.WEBHOOK_ID }}
webhook_token: ${{ secrets.WEBHOOK_TOKEN }}
args: '# Build #${{ github.run_number }} failed'
17 changes: 17 additions & 0 deletions buildAll
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

mkdir -p artifacts || true

for d in versionProperties/*; do
version=$(echo "$d" | sed "s/versionProperties\///" | sed "s/.properties//")

echo "==================== Cleaning workspace to build $version ===================="
sh gradlew clean -PmcVer="$version" --no-daemon || true
echo "====================Building $version ===================="
sh gradlew assemble -PmcVer="$version" --no-daemon || true
echo "==================== Moving jars ===================="
echo ''
mv "forge/build/libs/*" "artifacts/$version/" || true
mv "fabric/build/libs/*" "artifacts/$version/" || true
echo ''
done
3 changes: 2 additions & 1 deletion gradle/platform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ dependencies {

shadowJar {
exclude 'architectury.common.json'
exclude '**/PlatformMethods.class'

configurations = [project.configurations.shadowCommon, project.configurations.shade]
archiveClassifier = 'shadow'
}

remapJar {
input.set shadowJar.archiveFile
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier = null
}
Expand Down
4 changes: 0 additions & 4 deletions gradle/subprojects.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ processResources {
filesMatching('META-INF/mods.toml') {
expand properties
}

exclude { file ->
return (file.name.contains('.createunlimited.aw') && file.name != "${access_widener_version}.createunlimited.aw")
}
}

def manifold(String path) {
Expand Down

0 comments on commit d5e047c

Please sign in to comment.