2021-01-28 10:39:18 +08:00
|
|
|
name: Build
|
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2022-07-04 00:00:23 +08:00
|
|
|
- 'mirai-console/docs/**'
|
|
|
|
- '**/*.md'
|
2022-07-02 16:10:20 +08:00
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2022-07-04 00:00:23 +08:00
|
|
|
- 'mirai-console/docs/**'
|
|
|
|
- '**/*.md'
|
2021-01-28 10:39:18 +08:00
|
|
|
|
|
|
|
jobs:
|
2023-06-16 20:40:46 +08:00
|
|
|
build:
|
|
|
|
name: "Build (${{ matrix.os }})"
|
2021-12-19 01:29:37 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-11-17 20:17:56 +08:00
|
|
|
os: # You must use macos-12. Only macos-12 get 14GB memory while others have only 7GB.
|
2022-08-28 13:48:56 +08:00
|
|
|
# - windows-2022
|
|
|
|
- macos-12
|
2022-06-05 02:46:11 +08:00
|
|
|
env:
|
2023-06-16 20:40:46 +08:00
|
|
|
gradleArgs: --scan
|
2022-06-05 02:46:11 +08:00
|
|
|
isMac: ${{ startsWith(matrix.os, 'macos') }}
|
|
|
|
isWindows: ${{ startsWith(matrix.os, 'windows') }}
|
|
|
|
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
|
|
|
|
isUnix: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
|
2021-01-28 10:39:18 +08:00
|
|
|
steps:
|
2023-02-21 07:56:20 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-05 02:46:11 +08:00
|
|
|
with:
|
|
|
|
submodules: 'recursive'
|
2021-01-30 20:34:55 +08:00
|
|
|
|
2023-02-21 07:56:20 +08:00
|
|
|
- uses: actions/setup-java@v3
|
2021-01-28 10:39:18 +08:00
|
|
|
with:
|
2022-06-05 02:46:11 +08:00
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '17'
|
2021-01-30 20:49:19 +08:00
|
|
|
|
2022-06-05 02:46:11 +08:00
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
|
|
|
|
- if: ${{ env.isUnix == 'true' }}
|
2021-01-30 20:49:19 +08:00
|
|
|
run: chmod -R 777 *
|
|
|
|
|
2022-06-25 10:40:29 +08:00
|
|
|
- if: ${{ env.isWindows == 'true' }}
|
|
|
|
name: Setup Memory Environment on Windows
|
|
|
|
run: >
|
2022-07-02 16:10:20 +08:00
|
|
|
wmic pagefileset where name="D:\\pagefile.sys" set InitialSize=1024,MaximumSize=18432 &
|
2022-06-25 10:40:29 +08:00
|
|
|
net stop mongodb
|
|
|
|
shell: cmd
|
|
|
|
continue-on-error: true
|
2021-01-30 20:49:19 +08:00
|
|
|
|
2022-06-05 02:46:11 +08:00
|
|
|
- name: Clean and download dependencies
|
|
|
|
run: ./gradlew clean ${{ env.gradleArgs }}
|
|
|
|
|
2022-08-28 13:48:56 +08:00
|
|
|
- run: >
|
|
|
|
./gradlew updateSnapshotVersion ${{ env.gradleArgs }}
|
2023-03-19 20:43:44 +08:00
|
|
|
if: github.event.pusher && vars.RUN_MIRAI_SNAPSHOTS == 'true'
|
2022-08-28 13:48:56 +08:00
|
|
|
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 }}
|
2023-02-19 07:22:03 +08:00
|
|
|
MIRAI_BUILD_INDEX_AUTH_USERNAME: ${{ secrets.MIRAI_BUILD_INDEX_AUTH_USERNAME }}
|
|
|
|
MIRAI_BUILD_INDEX_AUTH_PASSWORD: ${{ secrets.MIRAI_BUILD_INDEX_AUTH_PASSWORD }}
|
2022-06-05 02:46:11 +08:00
|
|
|
|
2022-08-28 13:48:56 +08:00
|
|
|
- name: "Assemble"
|
|
|
|
run: ./gradlew assemble ${{ env.gradleArgs }}
|
2022-06-05 02:46:11 +08:00
|
|
|
|
2022-08-28 13:48:56 +08:00
|
|
|
- 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"
|
2022-06-05 02:46:11 +08:00
|
|
|
|
2022-08-28 13:48:56 +08:00
|
|
|
- name: "Check"
|
|
|
|
run: ./gradlew check ${{ env.gradleArgs }}
|
2022-06-05 02:46:11 +08:00
|
|
|
|
2023-06-16 20:40:46 +08:00
|
|
|
# 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 }}
|
|
|
|
|
2022-08-28 13:48:56 +08:00
|
|
|
# Upload
|
2022-06-05 02:46:11 +08:00
|
|
|
|
|
|
|
- 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
|
2021-01-30 20:49:19 +08:00
|
|
|
|
2022-06-05 02:46:11 +08:00
|
|
|
- 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
|