forked from mamoe/mirai
-
Notifications
You must be signed in to change notification settings - Fork 2
176 lines (146 loc) · 5.7 KB
/
build.yml
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Build
on:
push:
paths-ignore:
- 'docs/**'
- 'mirai-console/docs/**'
- '**/*.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'mirai-console/docs/**'
- '**/*.md'
jobs:
build:
name: "Build (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: # You must use macos-12. Only macos-12 get 14GB memory while others have only 7GB.
# - windows-2022
- macos-12
env:
gradleArgs: --scan
isMac: ${{ startsWith(matrix.os, 'macos') }}
isWindows: ${{ startsWith(matrix.os, 'windows') }}
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
isUnix: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- if: ${{ env.isUnix == 'true' }}
run: chmod -R 777 *
- if: ${{ env.isWindows == 'true' }}
name: Setup Memory Environment on Windows
run: >
wmic pagefileset where name="D:\\pagefile.sys" set InitialSize=1024,MaximumSize=18432 &
net stop mongodb
shell: cmd
continue-on-error: true
- name: Clean and download dependencies
run: ./gradlew clean ${{ env.gradleArgs }}
- run: >
./gradlew updateSnapshotVersion ${{ env.gradleArgs }}
if: github.event.pusher && vars.RUN_MIRAI_SNAPSHOTS == 'true'
env:
MIRAI_IS_SNAPSHOTS_PUBLISHING: true
SNAPSHOTS_PUBLISHING_USER: ${{ secrets.SNAPSHOTS_PUBLISHING_USER }}
SNAPSHOTS_PUBLISHING_KEY: ${{ secrets.SNAPSHOTS_PUBLISHING_KEY }}
SNAPSHOTS_PUBLISHING_URL: ${{ secrets.SNAPSHOTS_PUBLISHING_URL }}
MIRAI_BUILD_INDEX_AUTH_USERNAME: ${{ secrets.MIRAI_BUILD_INDEX_AUTH_USERNAME }}
MIRAI_BUILD_INDEX_AUTH_PASSWORD: ${{ secrets.MIRAI_BUILD_INDEX_AUTH_PASSWORD }}
- name: "Assemble"
run: ./gradlew assemble ${{ env.gradleArgs }}
- name: Publish Local Artifacts
if: ${{ env.enableLocalPublishingTest == 'true' }}
run: ./gradlew :mirai-deps-test:publishMiraiArtifactsToMavenLocal ${{ env.gradleArgs }} "-Dmirai.build.project.version=2.99.0-deps-test"
- name: "Check"
run: ./gradlew check ${{ env.gradleArgs }}
# Snapshots
- if: ${{ env.isMac == 'true' }}
name: Ensure KDoc valid
run: ./gradlew dokkaHtmlMultiModule ${{ env.gradleArgs }}
- name: Release RAM
run: node ci-release-helper/scripts/kill-java.js
- name: Publish Snapshots
if: ${{ github.event.pusher && env.isMac == 'true' && vars.RUN_MIRAI_SNAPSHOTS == 'true' }}
run: ./gradlew publishAllPublicationsToMiraiRepoRepository ${{ env.gradleArgs }}
env:
MIRAI_IS_SNAPSHOTS_PUBLISHING: true
SNAPSHOTS_PUBLISHING_USER: ${{ secrets.SNAPSHOTS_PUBLISHING_USER }}
SNAPSHOTS_PUBLISHING_KEY: ${{ secrets.SNAPSHOTS_PUBLISHING_KEY }}
SNAPSHOTS_PUBLISHING_URL: ${{ secrets.SNAPSHOTS_PUBLISHING_URL }}
# Upload
- name: Upload mirai-core-utils
uses: actions/upload-artifact@v3
with:
name: mirai-core-utils
path: mirai-core-utils/build/libs
- name: Upload mirai-core-api
uses: actions/upload-artifact@v3
with:
name: mirai-core-api
path: mirai-core-api/build/libs
- name: Upload mirai-core
uses: actions/upload-artifact@v3
with:
name: mirai-core
path: mirai-core/build/libs
- name: Upload mirai-core-all
uses: actions/upload-artifact@v3
with:
name: mirai-core-all
path: mirai-core-all/build/libs
- name: Upload mirai-console
uses: actions/upload-artifact@v3
with:
name: mirai-console
path: mirai-console/backend/mirai-console/build/libs
- name: Upload mirai-console-terminal
uses: actions/upload-artifact@v3
with:
name: mirai-console-terminal
path: mirai-console/frontend/mirai-console-terminal/build/libs
- name: Upload mirai-console-compiler-annotations
uses: actions/upload-artifact@v3
with:
name: mirai-console-compiler-annotations
path: mirai-console/tools/mirai-console-compiler-annotations/build/libs
- name: Upload mirai-console-compiler-common
uses: actions/upload-artifact@v3
with:
name: mirai-console-compiler-common
path: mirai-console/tools/mirai-console-compiler-common/build/libs
- name: Upload mirai-console-intellij
uses: actions/upload-artifact@v3
with:
name: mirai-console-intellij
path: mirai-console/tools/intelli-plugin/build/distribution
- name: Upload mirai-logging-log4j2
uses: actions/upload-artifact@v3
with:
name: mirai-logging-log4j2
path: logging/mirai-logging-log4j2/build/libs
- name: Upload mirai-logging-slf4j
uses: actions/upload-artifact@v3
with:
name: mirai-logging-slf4j
path: logging/mirai-logging-slf4j/build/libs
- name: Upload mirai-logging-slf4j-logback
uses: actions/upload-artifact@v3
with:
name: mirai-logging-slf4j-logback
path: logging/mirai-logging-slf4j-logback/build/libs
- name: Upload mirai-logging-slf4j-simple
uses: actions/upload-artifact@v3
with:
name: mirai-logging-slf4j-simple
path: logging/mirai-logging-slf4j-simple/build/libs