Always upload the jreleaser logs #182
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: Java CI with Gradle | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 | |
- name: Setup resource usage collection | |
run: | | |
# Create a script to log resource usage with timestamps | |
echo 'while true; do' > monitor_resources.sh | |
echo ' echo "$(date): Disk Usage:" >> resource_usage.log' >> monitor_resources.sh | |
echo ' df -h >> resource_usage.log' >> monitor_resources.sh | |
echo ' echo "" >> resource_usage.log' >> monitor_resources.sh | |
echo ' echo "$(date): CPU Usage:" >> resource_usage.log' >> monitor_resources.sh | |
echo ' top -b -n 1 | head -n 10 >> resource_usage.log' >> monitor_resources.sh | |
echo ' echo "" >> resource_usage.log' >> monitor_resources.sh | |
echo ' echo "$(date): Memory Usage:" >> resource_usage.log' >> monitor_resources.sh | |
echo ' free -h >> resource_usage.log' >> monitor_resources.sh | |
echo ' echo "" >> resource_usage.log' >> monitor_resources.sh | |
echo ' sleep 5' >> monitor_resources.sh | |
echo 'done' >> monitor_resources.sh | |
# Make the script executable | |
chmod +x monitor_resources.sh | |
# Start the script in the background | |
nohup ./monitor_resources.sh & | |
- name: Build with Gradle Wrapper | |
id: gradle_build | |
run: ./gradlew build -i || echo "Gradle build failed" > gradle_build_result.txt | |
continue-on-error: true | |
- name: Upload resource usage log | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: resource-usage-log | |
path: resource_usage.log | |
- name: Check build result | |
if: always() | |
run: | | |
if [ -f gradle_build_result.txt ]; then | |
echo "Build failed." | |
exit 1 | |
else | |
echo "Build succeeded." | |
fi | |
dependency-submission: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Generate and submit dependency graph | |
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 | |
javadoc: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build Javadoc | |
run: ./gradlew javadoc | |
- name: Deploy Pages Content | |
uses: JamesIves/[email protected] | |
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | |
if: ${{ always() && format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} | |
with: | |
folder: build/docs/javadoc |