Skip to content

simplified configuration & added use case #2877

simplified configuration & added use case

simplified configuration & added use case #2877

Workflow file for this run

name: Tests
on: [push, pull_request]
concurrency: # cancel previous workflow run if one exists.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Thanks, https://swiftpackageindex.com/docs/builds for help coming up with *how* we build the artifacts. Swift build on Linux, XCode build on mac. Changing the XCode version to a specific version is how to set what version of Swift we want to test against on macOS. This is more real-world but also because I encountered issues with trying to install a Swift version in the macOS environment and try to run tests on it.
# See example commands by choosing a package: https://swiftpackageindex.com/nativedevbr/swift-log/builds and viewing the build information for each environment to see the commands run in that environment.
jobs:
xcode-test:
strategy:
matrix:
# 13.3 = swift 5.6
# Thanks: https://swiftly.dev/swift-versions, https://xcodereleases.com/, https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#xcode
xcode: ["14.3"]
runs-on: macos-13
name: XCode macOS tests (xcode ${{ matrix.xcode }})
permissions:
checks: write # Need write permission to add test result check.
steps:
- uses: actions/checkout@v2
- name: Set up XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
# If running tests fails, sometimes it's because of scheme name is wrong. This gives us all available schemes.
- name: Get XCode schemes (xcode ${{ matrix.xcode }})
run: xcrun xcodebuild -list
- name: Setup Ruby to run Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
- name: Run tests (xcode ${{ matrix.xcode }})
uses: maierj/[email protected]
with:
lane: 'scan'
skip-tracking: true
# Read generate script file to learn more about this CI step.
- name: Generate code coverage report from .xcresult/
run: ./scripts/generate-code-coverage-report.sh
# Disable uploading code coverage for now until we investigate the 500 errors we're getting from Codecov.
# - name: Upload code coverage report
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} # not required for public repos, but sometimes uploads fail without it so include it anyway
# fail_ci_if_error: true # fail if upload fails so we can catch it and fix it right away.
# verbose: true
# directory: .build/generated
- name: Upload test report
uses: actions/upload-artifact@v2
with:
name: xcode-test-report
path: test-report.*
if: ${{ always() }}
- name: Publish test results
uses: mikepenz/action-junit-report@v2
with:
check_name: XCode macOS tests (xcode ${{ matrix.xcode }}) - Results
report_paths: test-report.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_failure: true
require_tests: true
if: ${{ always() }} # if running tests fails, we still want to parse the test results