-
-
Notifications
You must be signed in to change notification settings - Fork 211
149 lines (146 loc) · 5.96 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
# This workflow should have the same content as build-project.yaml, plus extra handling for publishing
name: Build and Deploy
on:
push:
branches: [ 'api-*' ]
env:
CACHE_REV: "1"
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ github.workspace}}/buildSrc/.gradle/
${{ github.workspace}}/forge/build/fg_cache
${{ github.workspace}}/.gradle/
key: "${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup workspace
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Build with Gradle
run: ./gradlew -PenableTestPlugins=true -PenableSpongeForge=true build --stacktrace
env:
CI_SYSTEM: Github Actions
- name: Archive artifacts for build
uses: actions/upload-artifact@v3
with:
name: Sponge Jars
path: |
${{ github.workspace }}/SpongeAPI/build/libs/*.jar
${{ github.workspace }}/build/libs/*.jar
${{ github.workspace }}/vanilla/build/libs/*.jar
${{ github.workspace }}/forge/build/libs/*.jar
- name: SpongeVanilla Production Jar
uses: actions/upload-artifact@v3
with:
name: SpongeVanilla Production Jar
path: "${{ github.workspace }}/vanilla/build/libs/*-universal.jar"
- name: SpongeForge Production Jar
uses: actions/upload-artifact@v3
with:
name: SpongeForge Production Jar
path: "${{ github.workspace }}/forge/build/libs/*-universal.jar"
- name: SpongeVanilla libraries
uses: actions/upload-artifact@v3
with:
name: SpongeVanilla installer libraries
path: "${{ github.workspace }}/vanilla/build/resources/installer/libraries.json"
integrationTest:
needs: build
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
java: [17]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository to use the build.gradle.kts as a hash file
uses: actions/checkout@v3
with:
path: code
- name: Download SpongeVanilla libraries as an additional hash file
uses: actions/download-artifact@v3
with:
name: SpongeVanilla installer libraries
path: "${{ github.workspace }}/code/libraries.json"
- name: "Setup JDK ${{ matrix.java }}"
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "${{ matrix.java }}"
- uses: actions/cache@v3
with:
path: "${{ github.workspace}}/libraries"
key: "${{runner.os}}-${{matrix.java}}-it-libraries-${{ hashFiles('code/build.gradle.kts') }}-${{ github.workspace }}/code/libraries.json"
restore-keys: "${{runner.os}}-${{matrix.java}}-it-libraries-"
- name: Download SpongeVanilla server
uses: actions/download-artifact@v3
with:
name: SpongeVanilla Production Jar
- name: Run SpongeVanilla Test (windows)
if: "runner.os == 'Windows'"
run: java "-Dmixin.debug.verbose=true" -jar $(gci | Where-Object NameString -Match "-universal.jar") --launchTarget sponge_server_it
- name: Run SpongeVanilla Test (other)
if: "runner.os != 'Windows'"
run: java -Dmixin.debug.verbose=true -jar *-universal.jar --launchTarget sponge_server_it
publish:
needs: integrationTest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ github.workspace}}/buildSrc/.gradle/
${{ github.workspace}}/forge/build/fg_cache
${{ github.workspace}}/.gradle/
key: "${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
# We don't need to run tests again, so we just publish
- name: Setup workspace
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Publish to Sponge Maven & GitHub Packages
# run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish :SpongeForge:publish
run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish
env:
CI_SYSTEM: Github Actions
GITHUB_USERNAME: "${{ github.actor }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
ORG_GRADLE_PROJECT_spongeSnapshotRepo: "${{ secrets.SPONGE_MAVEN_SNAPSHOT_REPO_URL }}"
ORG_GRADLE_PROJECT_spongeReleaseRepo: "${{ secrets.SPONGE_MAVEN_RELEASE_REPO_URL }}"
ORG_GRADLE_PROJECT_spongeUsername: "${{ secrets.SPONGE_MAVEN_REPO_USER }}"
ORG_GRADLE_PROJECT_spongePassword: "${{ secrets.SPONGE_MAVEN_REPO_PASSWORD }}"