From a3150a36948d6bb9b32dea15a7170af7bf4d3c8d Mon Sep 17 00:00:00 2001 From: Amir Panahandeh Date: Sun, 11 Aug 2024 22:38:49 +0330 Subject: [PATCH] Run master test in the same workflow --- .github/workflows/_run_performance_test.yaml | 37 +++++++++++++++++ .github/workflows/performance_test.yaml | 42 +++++++++----------- 2 files changed, 56 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/_run_performance_test.yaml diff --git a/.github/workflows/_run_performance_test.yaml b/.github/workflows/_run_performance_test.yaml new file mode 100644 index 00000000..bfd98f52 --- /dev/null +++ b/.github/workflows/_run_performance_test.yaml @@ -0,0 +1,37 @@ +name: Performance Test + +on: + workflow_call: + inputs: + branch: + type: string + required: true + artifact_name: + type: string + required: true + +jobs: + test: + runs-on: macOS-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{inputs.branch}} + + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.24.0" + cache: true + # Manually Update this `key` + cache-key: "3.24.0" + + - name: Run performance tests + working-directory: ./packages/fleather/example + run: | + flutter drive -d macos --driver=test_driver/performance_driver.dart --target=integration_test/scrolling_test.dart --profile + flutter drive -d macos --driver=test_driver/performance_driver.dart --target=integration_test/editing_test.dart --profile + + - uses: actions/upload-artifact@v4 + with: + name: ${{inputs.artifact_name}} + path: ./packages/fleather/example/build/performance_timelines \ No newline at end of file diff --git a/.github/workflows/performance_test.yaml b/.github/workflows/performance_test.yaml index e878b702..5cd23076 100644 --- a/.github/workflows/performance_test.yaml +++ b/.github/workflows/performance_test.yaml @@ -4,41 +4,37 @@ on: [push, pull_request, workflow_dispatch] jobs: test: - runs-on: macOS-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: "3.22.0" + flutter-version: "3.24.0" cache: true # Manually Update this `key` - cache-key: "3.22.0-stable" + cache-key: "3.24.0" - - name: Restore reference summary from cache - id: performance_timelines_cache_restore - uses: actions/cache/restore@v4 + - uses: ./.github/workflows/_run_performance_test.yaml with: - path: packages/fleather/example/build/performance_timelines - key: performance_timelines + branch: master + artifact_name: master_performance_timelines - - if: steps.performance_timelines_cache_restore.outputs.cache-hit == 'true' - run: mv packages/fleather/example/build/performance_timelines packages/fleather/example/build/reference_performance_timelines + - uses: ./.github/workflows/_run_performance_test.yaml + with: + branch: ${{github.ref}} + artifact_name: current_ref_performance_timelines - - name: Run performance tests - working-directory: ./packages/fleather/example - run: | - flutter drive -d macos --driver=test_driver/performance_driver.dart --target=integration_test/scrolling_test.dart --profile - flutter drive -d macos --driver=test_driver/performance_driver.dart --target=integration_test/editing_test.dart --profile + - uses: actions/download-artifact@v4 + with: + name: master_performance_timelines + - run: mv packages/fleather/example/build/performance_timelines packages/fleather/example/build/reference_performance_timelines + + - uses: actions/download-artifact@v4 + with: + name: current_ref_performance_timelines - name: Analyze results working-directory: ./packages/fleather/example - run: dart run test_utils/analyze_performance_result.dart - - - name: Save reference summary - if: github.ref == 'refs/heads/master' - uses: actions/cache/save@v4 - with: - path: build/performance_timelines - key: performance_timelines \ No newline at end of file + run: dart run test_utils/analyze_performance_result.dart \ No newline at end of file