-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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@v3 # 检出代码 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' # 设置 JDK 版本,JavaFX 需要 JDK 17 及以上版本 | ||
|
||
- name: Cache Gradle dependencies | ||
uses: actions/cache@v3 | ||
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 tests | ||
# run: ./gradlew test --no-daemon # 运行测试 | ||
# | ||
# - name: Package JavaFX Application | ||
# run: ./gradlew jfxJar # 使用 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..." |