diff --git a/.github/workflows/VerifyChanges.yaml b/.github/workflows/VerifyChanges.yaml new file mode 100644 index 0000000..cc18e93 --- /dev/null +++ b/.github/workflows/VerifyChanges.yaml @@ -0,0 +1,111 @@ +name: Verify Changes + +on: + merge_group: + pull_request: + branches: "**" + push: + branches: [ $default-branch ] + +jobs: + build-and-test: + name: Build and Test (${{ matrix.platform }}) + runs-on: macos-15 + strategy: + fail-fast: false + matrix: + include: + - platform: iOS + xcode_destination: "platform=iOS Simulator,name=iPhone 16 Pro" + - platform: macOS + xcode_destination: "platform=macOS,arch=arm64" + - platform: tvOS + xcode_destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation)" + - platform: watchOS + xcode_destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)" + env: + DEV_BUILDS: DevBuilds/Sources + XCCOV_PRETTY_VERSION: 1.1.0 + XCODE_SCHEME: DevTesting + XCODE_DESTINATION: ${{ matrix.xcode_destination }} + XCODE_TEST_PLAN: DevTesting + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout DevBuilds + uses: actions/checkout@v4 + with: + repository: DevKitOrganization/DevBuilds + path: DevBuilds + - name: Checkout xccovPretty + uses: actions/checkout@v4 + with: + repository: DevKitOrganization/xccovPretty + ref: ${{ env.XCCOV_PRETTY_VERSION }} + path: xccovPretty + - 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 }} + restore-keys: | + ${{ runner.os }}-spm- + - name: Select Xcode 16.4 + run: | + sudo xcode-select -s /Applications/Xcode_16.4.0.app + - name: Build for Testing + run: | + "$DEV_BUILDS"/build_and_test.sh --action build-for-testing + - name: Test + 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 + run: | + xcrun xccov view --report .build/DevTesting_test.xcresult --json \ + | swift run --quiet --skip-build --package-path xccovPretty xccovPretty --github-comment \ + > .build/xccovPretty-${{ matrix.platform }}.output + - name: Upload Logs + uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Logs-${{ matrix.platform }} + path: .build/*.log + include-hidden-files: true + - name: Upload XCResults + uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: XCResults-${{ matrix.platform }} + path: .build/*.xcresult + include-hidden-files: true + - name: Upload xccovPretty output + uses: actions/upload-artifact@v4 + with: + name: xccovPrettyOutput-${{ matrix.platform }} + path: .build/xccovPretty-${{ matrix.platform }}.output + include-hidden-files: true + post-pr-comments: + name: Post PR Comments + needs: build-and-test + permissions: + pull-requests: write + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + steps: + - name: Download xccovPretty output + uses: actions/download-artifact@v4 + with: + name: xccovPrettyOutput-iOS + - name: Post Code Coverage Comment + uses: thollander/actions-comment-pull-request@v3 + with: + file-path: xccovPretty-iOS.output + comment-tag: codeCoverage-iOS