build(github): add collaboration server #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: JavaFX Build and Test with Gradle | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest # 使用最新的 Ubuntu 环境 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 # 检出代码 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: "graalvm" | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches # 缓存 Gradle 的依赖 | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle*') }} # 缓存 key | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build with Gradle | |
run: ./gradlew build --no-daemon # 构建项目 | |
- name: Run jlink | |
run: ./gradlew jlink --no-daemon # 运行测试 | |
- name: Package JavaFX Application | |
run: ./gradlew jpackageImage # 使用 JavaFX 插件构建可运行的 JAR 文件(如果使用了 jfx-gradle-plugin) | |
- name: Shadow JavaFX Application | |
run: ./gradlew shadowJar # 使用 JavaFX 插件构建可运行的 JAR 文件(如果使用了 jfx-gradle-plugin) | |
# - name: Upload JAR artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: javafx-artifact | |
# path: build/libs/*.jar # 上传生成的 JAR 文件 | |
# | |
# - name: Deploy or release (optional) | |
# run: | | |
# echo "Deploying or releasing the application..." |