From 1d9dfd642de7ecccc47484f2c8ee914d049ac492 Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Wed, 29 Jan 2025 19:28:21 -0800 Subject: [PATCH 1/4] Add nicer unit test result page for Github Actions. --- .github/DangerFiles/TestResults.rb | 10 ---------- .github/workflows/reusable-workflow.yaml | 11 +++-------- 2 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 .github/DangerFiles/TestResults.rb diff --git a/.github/DangerFiles/TestResults.rb b/.github/DangerFiles/TestResults.rb deleted file mode 100644 index b39bef1fe5..0000000000 --- a/.github/DangerFiles/TestResults.rb +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby - -xcode_summary.ignores_warnings = true -xcode_summary.inline_mode = true - -if File.exist?('test.xcresult') - xcode_summary.report 'test.xcresult' -else - fail "No test results found." -end \ No newline at end of file diff --git a/.github/workflows/reusable-workflow.yaml b/.github/workflows/reusable-workflow.yaml index 36ac94ebea..ed796104e9 100644 --- a/.github/workflows/reusable-workflow.yaml +++ b/.github/workflows/reusable-workflow.yaml @@ -46,15 +46,10 @@ jobs: code-coverage: true upload-logs: always verbosity: xcbeautify - - uses: ruby/setup-ruby@v1 + - uses: slidoapp/xcresulttool@v3.1.0 with: - ruby-version: '3.3' - bundler-cache: true - - name: Danger Test Results - if: (github.event_name == 'pull_request') && failure() - env: - DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: bundle exec danger --dangerfile=TestResults.rb --danger_id=${{ inputs.lib }} + path: test.xcresult + if: success() || failure() - uses: codecov/codecov-action@v4 with: flags: ${{ inputs.lib }} From 2941b4302c9eed8e52ccef61b6cfd18d18870371 Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Wed, 29 Jan 2025 20:48:52 -0800 Subject: [PATCH 2/4] Make checkout ref conditional based on PR or Nightly. --- .github/workflows/pr.yaml | 3 ++- .github/workflows/reusable-workflow.yaml | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index bc4fbc6124..0b959f25e3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -34,7 +34,7 @@ jobs: # We need a sufficient depth or Danger will occasionally run into issues checking which files were modified. fetch-depth: 100 # This is dangerous without the member check - ref: ${{ github.head_ref }} + ref: ${{ github.event.pull_request.head.sha }} - name: Install Dependencies run: | npm install shelljs@0.8.5 @@ -102,4 +102,5 @@ jobs: uses: ./.github/workflows/reusable-workflow.yaml with: lib: ${{ matrix.lib }} + is_pr: true secrets: inherit diff --git a/.github/workflows/reusable-workflow.yaml b/.github/workflows/reusable-workflow.yaml index ed796104e9..03f823002a 100644 --- a/.github/workflows/reusable-workflow.yaml +++ b/.github/workflows/reusable-workflow.yaml @@ -16,6 +16,9 @@ on: default: macos-15 required: false type: string + is_pr: + type: boolean + default: false jobs: test-ios: @@ -24,10 +27,14 @@ jobs: BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile steps: - uses: actions/checkout@v4 - # We need a sufficient depth or Danger will occasionally run into issues - # checking which files were modified. + if: ${{ inputs.is_pr }} with: + # We need a sufficient depth or Danger will occasionally run into issues checking which files were modified. fetch-depth: 100 + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/checkout@v4 + if: ${{ ! inputs.is_pr }} + with: ref: ${{ github.head_ref }} - name: Install Dependencies env: From 4f1b0d450b531a3cdf7b43221525b76ef2589d71 Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Wed, 29 Jan 2025 21:49:40 -0800 Subject: [PATCH 3/4] More cleanup. --- .github/DangerFiles/Gemfile | 3 +- .github/DangerFiles/Gemfile.lock | 37 ++++++++++-------------- .github/workflows/pr.yaml | 4 +-- .github/workflows/reusable-workflow.yaml | 4 --- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/.github/DangerFiles/Gemfile b/.github/DangerFiles/Gemfile index 5ea887c6ef..a6220bb33a 100644 --- a/.github/DangerFiles/Gemfile +++ b/.github/DangerFiles/Gemfile @@ -1,5 +1,4 @@ source("https://rubygems.org") gem 'danger' -gem 'plist' -gem 'danger-xcode_summary' \ No newline at end of file +gem 'plist' \ No newline at end of file diff --git a/.github/DangerFiles/Gemfile.lock b/.github/DangerFiles/Gemfile.lock index 297bbfdbbb..bc041039ac 100644 --- a/.github/DangerFiles/Gemfile.lock +++ b/.github/DangerFiles/Gemfile.lock @@ -26,48 +26,42 @@ GEM octokit (>= 4.0) pstore (~> 0.1) terminal-table (>= 1, < 4) - danger-plugin-api (1.0.0) - danger (> 2.0) - danger-xcode_summary (1.3.1) - danger-plugin-api (~> 1.0) - xcresult (~> 0.2.2) - faraday (2.12.0) - faraday-net_http (>= 2.0, < 3.4) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) json logger faraday-http-cache (2.5.1) faraday (>= 0.8) - faraday-net_http (3.3.0) - net-http + faraday-net_http (3.4.0) + net-http (>= 0.5.0) git (1.19.1) addressable (~> 2.8) rchardet (~> 1.8) - json (2.7.5) - kramdown (2.4.0) - rexml + json (2.9.1) + kramdown (2.5.1) + rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - logger (1.6.1) + logger (1.6.5) nap (1.1.0) - net-http (0.4.1) + net-http (0.6.0) uri octokit (9.2.0) faraday (>= 1, < 3) sawyer (~> 0.9) open4 (1.3.4) - plist (3.7.1) - pstore (0.1.3) + plist (3.7.2) + pstore (0.1.4) public_suffix (6.0.1) - rchardet (1.8.0) - rexml (3.3.9) + rchardet (1.9.0) + rexml (3.4.0) sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) unicode-display_width (2.6.0) - uri (0.13.1) - xcresult (0.2.2) + uri (1.0.2) PLATFORMS arm64-darwin-23 @@ -75,8 +69,7 @@ PLATFORMS DEPENDENCIES danger - danger-xcode_summary plist BUNDLED WITH - 2.5.22 \ No newline at end of file + 2.5.22 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0b959f25e3..e527669490 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -52,7 +52,7 @@ jobs: - name: Report Static Analysis env: DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: bundle exec danger --dangerfile=StaticAnalysis.rb --danger_id=StaticAnalysis + run: bundle exec danger --dangerfile=.github/DanagerFiles/StaticAnalysis.rb --danger_id=StaticAnalysis test-orchestrator: runs-on: macos-15 @@ -91,7 +91,7 @@ jobs: run: | cd .github/DangerFiles bundle update && bundle install - bundle exec danger --dangerfile=TestOrchestrator.rb + bundle exec danger --dangerfile=.github/DangerFiles/TestOrchestrator.rb --danger_id="TestOrchestrator" ios-pr: needs: [test-orchestrator] diff --git a/.github/workflows/reusable-workflow.yaml b/.github/workflows/reusable-workflow.yaml index 03f823002a..8f03781666 100644 --- a/.github/workflows/reusable-workflow.yaml +++ b/.github/workflows/reusable-workflow.yaml @@ -23,14 +23,10 @@ on: jobs: test-ios: runs-on: ${{ inputs.macos }} - env: - BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile steps: - uses: actions/checkout@v4 if: ${{ inputs.is_pr }} with: - # We need a sufficient depth or Danger will occasionally run into issues checking which files were modified. - fetch-depth: 100 ref: ${{ github.event.pull_request.head.sha }} - uses: actions/checkout@v4 if: ${{ ! inputs.is_pr }} From 8e3a04349d9ac5f4434b31f9b4586fc80bb3fc0e Mon Sep 17 00:00:00 2001 From: Brandon Page Date: Wed, 29 Jan 2025 22:08:01 -0800 Subject: [PATCH 4/4] no message --- .github/workflows/pr.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e527669490..db231a2820 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -56,6 +56,8 @@ jobs: test-orchestrator: runs-on: macos-15 + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile outputs: libs: ${{ steps.test-orchestrator.outputs.libs }} steps: @@ -84,14 +86,15 @@ jobs: fetch-depth: 100 # This is dangerous without the member check ref: ${{ github.event.pull_request.head.sha }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true - name: Determine Tests to Run id: test-orchestrator env: DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd .github/DangerFiles - bundle update && bundle install - bundle exec danger --dangerfile=.github/DangerFiles/TestOrchestrator.rb --danger_id="TestOrchestrator" + run: bundle exec danger --dangerfile=.github/DangerFiles/TestOrchestrator.rb --danger_id="TestOrchestrator" ios-pr: needs: [test-orchestrator]