2 Commits

Author SHA1 Message Date
a65a57f9e2 ci(github-action): 减少矩阵量, 以免大量占用 Action 资源.
把 windows 系统移除, 因此只需要检查是否兼容 jvm 版本即可.
2022-08-18 12:50:49 +08:00
19cc1b9358 ci(github-action): 试着加入兼容性测试.
试一下 Github Action 的矩阵作业, 不过本项目可能还用不到兼容性测试, 所以本改动可能不会并入主分支.
2022-08-18 12:43:55 +08:00
8 changed files with 36 additions and 176 deletions

View File

@ -1,2 +0,0 @@
**/
!scalabot-app/build/install/

View File

@ -13,7 +13,7 @@ permissions:
contents: read
jobs:
build:
build-and-test:
timeout-minutes: 8
runs-on: ubuntu-latest
@ -25,7 +25,30 @@ jobs:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test
uses: gradle/gradle-build-action@v2.2.1
with:
gradle-version: 'wrapper'
arguments: test
compatibility-check:
timeout-minutes: 30
continue-on-error: true
strategy:
matrix:
os: [ ubuntu-latest ]
java-version: [ 11, 12, 13, 14, 15, 16, 17, 18 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt-hotspot'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test

View File

@ -1,65 +0,0 @@
name: Create release draft
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
# 该 Action 有以下步骤:
# 1. 拉取并构建代码, 然后生成 Application 发行包;
# 2. 创建 Release, 并标记为 Draft(草稿);
# 3. 上传 Application 发行包;
permissions:
contents: write
jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# 创建更新日志.
- name: 'Get Previous tag'
id: previous-tag
uses: younited/get-previous-tag-action@v1.0.0
with:
match: "v*.*.*"
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Commitizen
run: pip install -U commitizen
- name: Create Change log
run: cz ch --start-rev ${{ steps.previous-tag.outputs.previous-tag }} --file-name ${{ github.workspace }}/CURRENT_CHANGELOG.md
# 开始构建项目.
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test
uses: gradle/gradle-build-action@v2.2.1
with:
gradle-version: 'wrapper'
arguments: clean test assembleDist
# 创建新的发行版本
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: true
body_path: ${{ github.workspace }}/CURRENT_CHANGELOG.md
files: |
*/build/distributions/*
*/build/libs/*

View File

@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1

View File

@ -1,49 +0,0 @@
name: Release container image
on:
release:
types:
- published
env:
IMAGE_NAME: lamgc/scalabot
jobs:
release-image:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test
uses: gradle/gradle-build-action@v2.2.1
with:
gradle-version: 'wrapper'
arguments: clean test installDist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:latest, ${{ env.IMAGE_NAME }}:${{ github.ref_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -1,49 +0,0 @@
name: Build development version container image
on:
push:
branches:
- "main"
permissions:
contents: read
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build project and install Distribution package
uses: gradle/gradle-build-action@v2.2.1
with:
gradle-version: 'wrapper'
arguments: installDist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: lamgc/scalabot:dev
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -1,8 +0,0 @@
FROM openjdk:18
ENV BOT_DATA_PATH /scalabot/data/
WORKDIR /scalabot/run/
CMD ["/scalabot/app/bin/scalabot-app"]
COPY scalabot-app/build/install/scalabot-app/ /scalabot/app/

View File

@ -12,5 +12,5 @@ allprojects {
}
group = "net.lamgc"
version = "0.5.1"
version = "0.5.0"
}