-
Notifications
You must be signed in to change notification settings - Fork 21
66 lines (56 loc) · 2.19 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Tests
on:
pull_request:
push:
branches: [main] # code coverage reporting needs to be on main so all PRs can compare against it.
concurrency: # cancel previous workflow run if one exists.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
automated-tests:
runs-on: macos-14
permissions:
checks: write # Need write permission to add test result check.
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-ios
# If running tests fails, sometimes it's because of scheme name is wrong. This gives us all available schemes.
- name: Get XCode schemes
run: xcrun xcodebuild -list
- name: Setup Ruby to run Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true # install dependencies in Gemfile, including Fastlane.
- name: Run tests
uses: maierj/[email protected]
with:
lane: 'scan'
# https://about.codecov.io/blog/pre-converting-xcresult-files-for-codecov-using-xcresultparser/
- name: Generate code coverage report from .xcresult/ that can be converted to codecov format
run: |
brew tap a7ex/homebrew-formulae && brew install xcresultparser
xcresultparser --output-format cobertura "Customer.io-Package.xcresult" > ".build/coverage.xml"
- name: Upload code coverage report
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
with:
files: .build/coverage.xml
fail_ci_if_error: true # fail if upload fails so we can catch it and fix it right away.
verbose: true
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: xcode-test-report
path: test-report.*
if: ${{ always() }}
- name: Publish test results
uses: mikepenz/action-junit-report@v5
with:
check_name: XCode macOS tests - 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