-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (123 loc) · 4.43 KB
/
tests.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Tests
on:
push:
branches: [ main ]
paths:
- 'dist/*.js'
- '.github/workflows/tests.yml'
pull_request:
branches: [ main ]
jobs:
test-defaults:
name: Test Default Inputs
strategy:
matrix:
os: [ macos-12, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: maxim-lobanov/setup-xcode@v1
if: ${{ runner.os == 'macOS' }}
with:
xcode-version: ^14.0
- name: Install Swift
if: ${{ runner.os == 'Linux' }}
uses: sersoft-gmbh/swifty-linux-action@v3
with:
release-version: 5.7
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@v3
if: ${{ runner.os == 'macOS' }}
with:
spm-package: __test__/TestProject
scheme: TestProject-Package
destination: platform=macOS
action: test
enable-code-coverage: true
parallel-testing-enabled: true
- run: swift test --parallel --enable-code-coverage
working-directory: __test__/TestProject
- run: ln -s __test__/TestProject/.build .build
- uses: sersoft-gmbh/swift-coverage-action@main
if: ${{ github.event_name == 'push' }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
- name: Check for produced coverage files
run: | # check that the directory exists and contains files
test -d '.swiftcov' && \
test "$(find '.swiftcov' -name '*.lcov')" != ''
test-customized:
name: Test Customized Inputs
strategy:
matrix:
os: [ macos-12, ubuntu-latest ]
cov-format: [ 'txt', 'lcov' ]
env:
INPUT_DERIVED_DATA: .derived-data
INPUT_SEARCH_PATHS: |
__test__/TestProject/.build
.derived-data
INPUT_TARGET_NAME_FILTER: TestProject(1|Package).*
INPUT_OUTPUT_FOLDER: .swiftcov-test
runs-on: ${{ matrix.os }}
steps:
- uses: maxim-lobanov/setup-xcode@v1
if: ${{ runner.os == 'macOS' }}
with:
xcode-version: ^14.0
- name: Install Swift
if: ${{ runner.os == 'Linux' }}
uses: sersoft-gmbh/swifty-linux-action@v3
with:
release-version: 5.7
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@v3
if: ${{ runner.os == 'macOS' }}
with:
spm-package: __test__/TestProject
scheme: TestProject-Package
destination: platform=macOS
action: test
enable-code-coverage: true
parallel-testing-enabled: true
derived-data-path: ${{ env.INPUT_DERIVED_DATA }}
- run: swift test --parallel --enable-code-coverage
working-directory: __test__/TestProject
- uses: sersoft-gmbh/swift-coverage-action@main
if: ${{ github.event_name == 'push' }}
with:
format: ${{ matrix.cov-format }}
search-paths: ${{ env.INPUT_SEARCH_PATHS }}
output: ${{ env.INPUT_OUTPUT_FOLDER }}
target-name-filter: ${{ env.INPUT_TARGET_NAME_FILTER }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
with:
format: ${{ matrix.cov-format }}
search-paths: ${{ env.INPUT_SEARCH_PATHS }}
output: ${{ env.INPUT_OUTPUT_FOLDER }}
target-name-filter: ${{ env.INPUT_TARGET_NAME_FILTER }}
- name: Check for produced coverage files
env:
RUNNER_OS: ${{ runner.os }}
COV_FORMAT: ${{ matrix.cov-format }}
run: | # check that the directory exists and contains files
test -d "${INPUT_OUTPUT_FOLDER}" && { \
{ \
test "${RUNNER_OS}" == 'macOS' && \
test "$(find "${INPUT_OUTPUT_FOLDER}" -name "TestProject1*.${COV_FORMAT}")" != ''; \
} \
|| \
{ \
test "${RUNNER_OS}" == 'Linux' && \
test "$(find "${INPUT_OUTPUT_FOLDER}" -name "TestProjectPackage*.${COV_FORMAT}")" != ''; \
}; \
} && \
test "$(find "${INPUT_OUTPUT_FOLDER}" -name "TestProject2*.${COV_FORMAT}")" == ''