Skip to content

Commit

Permalink
测试功能
Browse files Browse the repository at this point in the history
  • Loading branch information
khaos committed Dec 7, 2024
1 parent ef7ae97 commit 66f09ef
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,46 +94,58 @@ jobs:
echo "jdk_installed=false" >> $GITHUB_ENV
fi
# 缓存 JDK
- name: 缓存 JDK
if: env.jdk_installed == 'false'
uses: actions/cache@v3
with:
path: ~/.sdkman/candidates
key: ${{ runner.os }}-jdk-11-${{ hashFiles('**/build.gradle*') }}
restore-keys: |
${{ runner.os }}-jdk-11-
- name: 安装 JDK 11
if: env.jdk_installed == 'false' && env.should_build == 'true'
run: |
sudo apt update
sudo apt install -y openjdk-11-jdk
- name: 验证 JDK 安装
if: env.should_build == 'true'
run: |
java -version
# 检查 Gradle 是否已安装
- name: 检查 Gradle 是否已安装
id: check_gradle
run: |
if ./gradlew -v &>/dev/null; then
if gradle -v &>/dev/null; then
echo "Gradle 已安装"
echo "gradle_installed=true" >> $GITHUB_ENV
else
echo "Gradle 未安装"
echo "gradle_installed=false" >> $GITHUB_ENV
fi
# 缓存 JDK
- name: 缓存 JDK
if: env.jdk_installed == 'false'
uses: actions/cache@v3
with:
path: ~/.sdkman/candidates
key: ${{ runner.os }}-jdk-11-${{ hashFiles('**/build.gradle*') }}
restore-keys: |
${{ runner.os }}-jdk-11-
# 缓存 Gradle
- name: 手动缓存 Gradle 构建
- name: 缓存 Gradle
if: env.gradle_installed == 'false'
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/gradle-wrapper.properties') }}
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-build-
${{ runner.os }}-gradle-
- name: 安装 JDK 11
if: env.jdk_installed == 'false' && env.should_build == 'true'
# 安装 Gradle
- name: 安装 Gradle
if: env.gradle_installed == 'false' && env.should_build == 'true'
run: |
sudo apt update
sudo apt install -y openjdk-11-jdk
sudo apt install -y gradle
- name: 验证 JDK 安装
# 验证 Gradle 安装
- name: 验证 Gradle 安装
if: env.should_build == 'true'
run: |
java -version
gradle -v

0 comments on commit 66f09ef

Please sign in to comment.