From c6c2a89484171269cb8613fa84952a155e8b0006 Mon Sep 17 00:00:00 2001 From: Prachi Gauriar Date: Fri, 11 Jul 2025 14:46:54 -0400 Subject: [PATCH] Update verify changes workflow to improve performance --- .github/workflows/VerifyChanges.yaml | 47 +++++++++++++++------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/workflows/VerifyChanges.yaml b/.github/workflows/VerifyChanges.yaml index 996e962..6f43fca 100644 --- a/.github/workflows/VerifyChanges.yaml +++ b/.github/workflows/VerifyChanges.yaml @@ -5,13 +5,12 @@ on: pull_request: branches: "**" push: - branches: [ $default-branch ] + branches: ["main"] jobs: lint: name: Lint runs-on: macos-15 - if: ${{ github.event_name == 'pull_request' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -47,7 +46,7 @@ jobs: xcode_scheme: "DevKeychain" env: DEV_BUILDS: DevBuilds/Sources - XCCOV_PRETTY_VERSION: 1.1.0 + XCCOV_PRETTY_VERSION: 1.2.0 XCODE_PROJECT: ${{ matrix.xcode_project }} XCODE_SCHEME: ${{ matrix.xcode_scheme }} XCODE_DESTINATION: ${{ matrix.xcode_destination }} @@ -59,24 +58,28 @@ jobs: with: repository: DevKitOrganization/DevBuilds path: DevBuilds - - name: Checkout xccovPretty - uses: actions/checkout@v4 - with: - repository: DevKitOrganization/xccovPretty - ref: ${{ env.XCCOV_PRETTY_VERSION }} - path: xccovPretty + - name: Download xccovPretty + if: github.event_name != 'push' + run: | + gh release download ${{ env.XCCOV_PRETTY_VERSION }} \ + --repo DevKitOrganization/xccovPretty \ + --pattern "xccovPretty-macos.tar.gz" \ + -O - | tar -xz + chmod +x xccovPretty + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: irgaly/xcode-cache@v1 with: - key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }} - restore-keys: xcode-cache-deriveddata-${{ github.workflow }}- - deriveddata-directory: .build/DerivedData - - name: xccovPretty cache - uses: actions/cache@v4 - with: - path: xccovPretty/.build - key: ${{ runner.os }}-spm-${{ env.XCCOV_PRETTY_VERSION }} + key: xcode-cache-deriveddata-${{ github.workflow }}-${{ matrix.platform }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-spm- + xcode-cache-deriveddata-${{ github.workflow }}-${{ matrix.platform }}- + xcode-cache-deriveddata- + deriveddata-directory: .build/DerivedData + sourcepackages-directory: .build/DerivedData/SourcePackages + swiftpm-package-resolved-file: | + **/*.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved + Package.resolved + verbose: true - name: Select Xcode 16.4 run: | sudo xcode-select -s /Applications/Xcode_16.4.0.app @@ -84,15 +87,14 @@ jobs: run: | "$DEV_BUILDS"/build_and_test.sh --action build-for-testing - name: Test + if: github.event_name != 'push' run: | "$DEV_BUILDS"/build_and_test.sh --action test - - name: Build xccovPretty - run: | - swift build --package-path xccovPretty --disable-automatic-resolution - name: Log Code Coverage + if: github.event_name != 'push' run: | xcrun xccov view --report .build/${{ matrix.xcode_scheme }}_test.xcresult --json \ - | swift run --quiet --skip-build --package-path xccovPretty xccovPretty --github-comment \ + | ./xccovPretty --github-comment \ > .build/xccovPretty-${{ matrix.platform }}.output - name: Upload Logs uses: actions/upload-artifact@v4 @@ -109,6 +111,7 @@ jobs: path: .build/*.xcresult include-hidden-files: true - name: Upload xccovPretty output + if: github.event_name != 'push' uses: actions/upload-artifact@v4 with: name: xccovPrettyOutput-${{ matrix.platform }}