From f172f13e862b52bf813d4b0e56a83b58903aa7ed Mon Sep 17 00:00:00 2001 From: Sven Meyer Date: Wed, 11 Dec 2024 12:55:07 +0100 Subject: [PATCH] Split into multiple jobs --- .github/workflows/performance_pre.yml | 102 ++++---------------------- 1 file changed, 15 insertions(+), 87 deletions(-) diff --git a/.github/workflows/performance_pre.yml b/.github/workflows/performance_pre.yml index aecaa1918..1489b626a 100644 --- a/.github/workflows/performance_pre.yml +++ b/.github/workflows/performance_pre.yml @@ -21,13 +21,11 @@ env: JAVA_VERSION: 17 jobs: - performance-pre: + performance-android: runs-on: ubuntu-latest steps: - name: Checkout source code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Build and test Android Scanner uses: ./.github/actions/scanner-android @@ -44,102 +42,32 @@ jobs: source-branch: gh-pages current-results: android_history.txt output-file: gh-pages-output/android_history.txt - - - name: Generate HTML report - run: | - echo "

Aggregated Test Results

" >> gh-pages-output/index.html - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v4 + + - name: Store Android performance + uses: actions/upload-artifact@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./gh-pages-output + name: android-performance + path: gh-pages-output/android_history.txt - performance-pre-2: - if: false + performance-report: runs-on: ubuntu-latest + needs: performance-android steps: - name: Checkout source code uses: actions/checkout@v4 with: - fetch-depth: 0 - # Sets up Java version - - name: Set up Java ${{ env.JAVA_VERSION }} - uses: actions/setup-java@v4 - with: - distribution: adopt - java-package: jdk - java-version: ${{ env.JAVA_VERSION }} - # Restores Maven dependencies - - name: Restore local Maven repository - uses: actions/cache@v4 + ref: gh-pages + + - name: Load performance files + uses: actions/download-artifact@v4 with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Run maven command - run: mvn clean verify -DrunAnalysisTests + path: gh-pages-output + merge-multiple: true - - name: Create or update gh-pages-output directory - run: mkdir -p gh-pages-output - - - name: Aggregate test results from multiple directories - run: | - total_time=0 - for dir in CryptoAnalysis/shippable/testresults; do - if [ -d "$dir" ]; then - echo "Processing directory: $dir" - for file in "$dir"/*.txt; do - if [ -f "$file" ]; then - echo "Processing file: $file" - # Extract the time elapsed from each relevant line in the file and sum it up - file_time=$(grep -oP "Time elapsed: \K[\d\.]+" "$file" | awk '{sum += $1} END {print sum}') - if [ -n "$file_time" ]; then - echo "Time found: $file_time seconds" - total_time=$(echo "$total_time + $file_time" | bc) - else - echo "No time elapsed found in file: $file" - fi - else - echo "No files found in directory: $dir" - fi - done - else - echo "Directory does not exist: $dir" - fi - done - - # Convert total time to minutes, seconds, and milliseconds - total_time_int=$(printf "%.0f" "$total_time") - minutes=$((total_time_int / 60)) - seconds=$((total_time_int % 60)) - milliseconds=$(printf "%.0f" "$(echo "($total_time - $total_time_int) * 1000" | bc)") - - echo "Total Time Calculated: ${minutes}m ${seconds}s ${milliseconds}ms" - timestamp=$(date +"%Y-%m-%d %H:%M:%S") - run_number=${{ github.run_number }} - echo "Run ${run_number}, ${timestamp}, Total Time: ${minutes}m ${seconds}s ${milliseconds}ms" >> gh-pages-output/current_history.txt - - - name: Combine current and past history - run: | - git checkout gh-pages - if [ -f current_history.txt ]; then - echo "current history" - git checkout gh-pages current_history.txt - cat gh-pages-output/current_history.txt >> current_history.txt - mv current_history.txt gh-pages-output/current_history.txt - fi - - name: Generate HTML report run: | echo "

Aggregated Test Results