continue on test error and publish the resource usage at the end of t… #47
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: Start resource usage collection | |
run: | | |
# Create a script to log resource usage | |
echo 'while true; do' > monitor_resources.sh | |
echo ' echo "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 "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 "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 30' >> 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 | |
run: ./gradlew build -i | |
continue-on-error: true | |
- name: Display collected resource usage | |
if: always() | |
run: | | |
cat resource_usage.log | |
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 |