-
Notifications
You must be signed in to change notification settings - Fork 5
137 lines (110 loc) · 3.93 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
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
127
128
129
130
131
132
133
134
135
136
137
name: Test
on:
push:
branches: [ main, rewrite ]
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
pull_request:
branches: [ "**" ]
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
jobs:
build-devcontainer:
name: "Devcontainer: ${{ matrix.host.os }}/${{ matrix.configuration }}"
strategy:
fail-fast: false
matrix:
host: [
{ type: linux, os: ubuntu-latest, test-options: --enable-code-coverage, }
]
configuration: [ "debug", "release" ]
runs-on: ${{ matrix.host.os }}
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- run: git config --global core.autocrlf input
- name: Build and run devcontainer task
uses: devcontainers/[email protected]
with:
runCmd: swift test --parallel -v -c ${{ matrix.configuration }} ${{ matrix.host.test-options }}
build-native:
name: "Native: ${{ matrix.host.os }}/${{ matrix.configuration }}"
strategy:
fail-fast: false
matrix:
host: [
{ type: macos, os: macos-latest}
]
configuration: [ "debug", "release" ]
runs-on: ${{ matrix.host.os }}
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- run: git config --global core.autocrlf input
- name: Setup Swift
uses: swift-actions/setup-swift@v1
- run: swift --version
- name: Install LLVM
uses: KyleMayes/install-llvm-action@v1
with:
version: "15.0"
- run: llvm-config --version
- name: Configure pkgconfig
run: sudo ./Tools/make-pkgconfig.sh /usr/local/lib/pkgconfig/llvm.pc
- name: Test
run: swift test --enable-code-coverage -v -c ${{ matrix.configuration }} ${{ matrix.host.test-options }}
- name: Export Coverage
run: |
dot_os=(.build/${{ matrix.configuration }}/*.build/**/*.o)
bin_params=("${dot_os[0]}")
for o in "${dot_os[@]:1}"; do
bin_params+=("-object" "${o}")
done
llvm-cov export -format="lcov" -instr-profile "$(swift test -c ${{ matrix.configuration }} --show-codecov-path | xargs dirname)"/default.profdata "${bin_params[@]}" > info.lcov
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
flags: ${{ matrix.host.os }},${{ matrix.configuration }}
build-native-windows:
name: "Native: windows-latest/debug"
strategy:
fail-fast: false
runs-on: windows-latest
steps:
- name: Setup swift
uses: compnerd/[email protected]
with:
github-repo: thebrowsercompany/swift-build
release-asset-name: installer-amd64.exe
release-tag-name: 20231130.2
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
submodules: true
show-progress: false
- name: Swift version
run: swift --version
- name: Set up LLVM 15.0.6
run: |
curl.exe -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"https://github.com/c3lang/win-llvm/releases/download/llvm_15_0_6/llvm-15.0.6-windows-x86-msvc17-msvcrt.7z
7z x llvm-15.0.6-windows-x86-msvc17-msvcrt.7z -oC:\
Add-Content $env:GITHUB_PATH 'C:\llvm-15.0.6-windows-x86-msvc17-msvcrt\bin'
- run: llvm-config --version
- name: Generate LLVM pkgconfig file
run: |
swift package resolve
& "C:\Program Files\Git\bin\bash.exe" Tools/make-pkgconfig.sh llvm.pc
type llvm.pc
- run: llvm-config --version
- name: Prevent reentrant builds for speed
run: echo 'SPM_BUILD_TOOL_SUPPORT_NO_REENTRANT_BUILD=1' >> $env:GITHUB_ENV
- name: Build (Debug)
run: swift build --explicit-target-dependency-import-check error --build-tests --pkg-config-path .
- name: Test (Debug)
run: swift test --parallel --skip-build --pkg-config-path .