From 2f701a7bf3e0d324e4d8a56e3bbb257bad25a3ee Mon Sep 17 00:00:00 2001 From: Alina Zacaria Date: Fri, 29 Nov 2024 19:13:12 -0600 Subject: [PATCH] correct artifact version --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07ca97a..0a09d82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - # Checkout the code - name: Checkout code uses: actions/checkout@v2 - # Cache Maven dependencies - name: Cache Maven dependencies uses: actions/cache@v2 with: @@ -24,17 +22,51 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - # Build with Maven (check for compilation errors) - name: Build with Maven run: mvn clean install - # Run Checkstyle (static code analysis) - name: Run Checkstyle run: mvn checkstyle:check - # Count Lines of Code using cloc - name: Count Lines of Code run: | sudo apt-get update sudo apt-get install -y cloc - cloc --exclude-dir=target --quiet . \ No newline at end of file + cloc --exclude-dir=target --quiet . + + # Measure execution time, throughput, error rate, memory usage, and call count + - name: Measure Java Application Metrics + run: | + # Install jq for parsing JSON results + sudo apt-get install jq + + # Run tests with metrics (timing, error rate, throughput, etc.) + mvn test | tee result.log + + # Extract test execution time + test_duration=$(grep "Total time" result.log | sed 's/[^0-9]*\([0-9]*\)[^0-9]*/\1/') + echo "Test Execution Time: $test_duration seconds" + + # Extract error rate (failed tests) + failed_tests=$(grep -c 'FAILURE' result.log) + total_tests=$(grep -c 'Tests run' result.log) + error_rate=$(echo "scale=2; $failed_tests / $total_tests * 100" | bc) + echo "Error Rate: $error_rate%" + + # Extract throughput (tests per second) + throughput=$(echo "scale=2; $total_tests / $test_duration" | bc) + echo "Throughput: $throughput tests per second" + + # Measure memory usage with jvm options during test run + echo "Memory Usage (heap size):" + jps -v | grep 'java' + + # Check method call count (assumes logging for call count) + call_count=$(grep -o 'methodCallCount' result.log | wc -l) + echo "Call Count: $call_count" + + - name: Upload test results to GitHub + uses: actions/upload-artifact@v3 + with: + name: test-results + path: result.log \ No newline at end of file