have another go at setting up continuous monitoring on github runner #46
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 continuous monitoring | |
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 | |
- name: Display collected resource usage | |
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 |