-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
63 lines (58 loc) · 2.33 KB
/
action.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
name: 'swifty-code-coverage'
description: 'An action that generates code coverage report for swift projects (iOS, macOS, spm, etc).'
branding:
icon: 'activity'
color: 'green'
inputs:
build-path:
description: "Build path. Either the DerivedData (iOS or macOS) or .build folder(for SPM)."
required: true
target:
description: "Either the .app (iOS or macOS app, eg. MyApp.app) or the .xctest (SPM, Eg. MyAppTests.xctest)"
required: true
is-spm:
description: "is the project is an SPM project?"
required: false
default: false
ignore-filename-regex:
description: "Filename regex to be ignored. default is `.build|Tests|Pods|Carthage|DerivedData`"
required: false
default: ".build|Tests|Pods|Carthage|DerivedData"
output:
description: "The output file. default is `coverage/lcov.info`"
required: false
default: "coverage/lcov.info"
output-artifact-name:
description: "The name of the output artifact. default is 'code-coverage-artifact'"
required: false
default: "code-coverage-artifact"
runs:
using: "composite"
steps:
- if: runner.os == 'Linux'
name: Generate coverage file (Linux)
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
brew install llvm && \
PATH="$PATH:$(brew --prefix llvm)/bin" && \
sh $GITHUB_ACTION_PATH/lcov.sh --build-path "${{ inputs.build-path }}" --target "${{ inputs.target }}" --is-spm "${{ inputs.is-spm }}" --ignore-filename-regex "${{ inputs.ignore-filename-regex }}" --output "${{ inputs.output }}" | tee coverage.txt
shell: bash
- if: runner.os == 'macOS'
name: Generate coverage file (macOS)
run: |
sh $GITHUB_ACTION_PATH/lcov.sh --build-path "${{ inputs.build-path }}" --target "${{ inputs.target }}" --is-spm "${{ inputs.is-spm }}" --ignore-filename-regex "${{ inputs.ignore-filename-regex }}" --output "${{ inputs.output }}" | tee coverage.txt
shell: bash
- name: Archive the code coverage file (lcov)
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.output-artifact-name }}
path: |
${{ inputs.output }}
- name: Archive the code coverage file (textfile)
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-textfile
path: |
coverage.txt