Skip to content

Commit 1e9933e

Browse files
authored
workflows: mock up a code-coverage workflow (#562)
This sets up the initial workflow for getting code-coverage information from the build. Because we want to track the changes overtime, the uploaded status should be based on the merged changes, though it would be nice to get indication on how a change influences the coverage. This is currently disabled, requiring manual invocation; it also adds a few workarounds until an updated snapshot can be rolled out.
1 parent a796eec commit 1e9933e

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: coverage
2+
3+
on:
4+
# push:
5+
# branches:
6+
# - main
7+
# paths:
8+
# - '**/*.swift'
9+
# - '!Examples/**/*.swift'
10+
workflow_dispatch:
11+
12+
jobs:
13+
coverage:
14+
runs-on: windows-latest
15+
16+
strategy:
17+
matrix:
18+
include:
19+
- tag: DEVELOPMENT-SNAPSHOT-2021-05-17-a
20+
branch: development
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: seanmiddleditch/gha-setup-vsdevenv@master
25+
26+
- name: Install Swift ${{ matrix.tag }}
27+
run: |
28+
Install-Binary -Url "https://swift.org/builds/${{ matrix.branch }}/windows10/swift-${{ matrix.tag }}/swift-${{ matrix.tag }}-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
29+
- name: Set Environment Variables
30+
run: |
31+
echo "SDKROOT=C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
32+
echo "DEVELOPER_DIR=C:\Library\Developer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
33+
- name: Adjust Paths
34+
run: |
35+
echo "C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
36+
echo "C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
37+
- name: Install Supporting Files
38+
run: |
39+
Copy-Item "$env:SDKROOT\usr\share\ucrt.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\ucrt\module.modulemap"
40+
Copy-Item "$env:SDKROOT\usr\share\visualc.modulemap" -destination "$env:VCToolsInstallDir\include\module.modulemap"
41+
Copy-Item "$env:SDKROOT\usr\share\visualc.apinotes" -destination "$env:VCToolsInstallDir\include\visualc.apinotes"
42+
Copy-Item "$env:SDKROOT\usr\share\winsdk.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\um\module.modulemap"
43+
44+
- name: WORKAROUND_SR?????, WORKAROUND_SR?????
45+
run: |
46+
# The correct location
47+
New-Item -Path C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\clang\12.0.0\lib\x86_64-unknown-windows-msvc -ItemType Directory
48+
Invoke-WebRequest -Uri "https://artprodeus21.artifacts.visualstudio.com/A8fd008a0-56bc-482c-ba46-67f9425510be/3133d6ab-80a8-4996-ac4f-03df25cd3224/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2NvbXBuZXJkL3Byb2plY3RJZC8zMTMzZDZhYi04MGE4LTQ5OTYtYWM0Zi0wM2RmMjVjZDMyMjQvYnVpbGRJZC81MTM4NS9hcnRpZmFjdE5hbWUvdG9vbGNoYWluLXdpbmRvd3MteDY00/content?format=file&subPath=%2FLibrary%2FDeveloper%2FToolchains%2Funknown-Asserts-development.xctoolchain%2Fusr%2Flib%2Fclang%2F12.0.0%2Flib%2Fx86_64-unknown-windows-msvc%2Fclang_rt.profile.lib" -OutFile C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\clang\12.0.0\lib\x86_64-unknown-windows-msvc\clang_rt.profile.lib
49+
# Workaround for the toolchain issue
50+
New-Item -Path C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\clang\lib\windows
51+
Invoke-WebRequest -Uri "https://artprodeus21.artifacts.visualstudio.com/A8fd008a0-56bc-482c-ba46-67f9425510be/3133d6ab-80a8-4996-ac4f-03df25cd3224/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2NvbXBuZXJkL3Byb2plY3RJZC8zMTMzZDZhYi04MGE4LTQ5OTYtYWM0Zi0wM2RmMjVjZDMyMjQvYnVpbGRJZC81MTM4NS9hcnRpZmFjdE5hbWUvdG9vbGNoYWluLXdpbmRvd3MteDY00/content?format=file&subPath=%2FLibrary%2FDeveloper%2FToolchains%2Funknown-Asserts-development.xctoolchain%2Fusr%2Flib%2Fclang%2F12.0.0%2Flib%2Fx86_64-unknown-windows-msvc%2Fclang_rt.profile.lib" -OutFile C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\clang\lib\windows\clang_rt.profile-x86_64.lib
52+
53+
- name: Build
54+
run: swift build -v
55+
56+
- name: Run tests
57+
run: swift test -v -Xswiftc -DENABLE_TESTING -enable-code-coverage
58+
59+
- name: Process Coverage
60+
run: |
61+
llvm-cov export -format lcov -ignore-filename-regex ".build|Tests|Examples" -instr-profile .build\x86_64-unknown-windows-msvc\debug\codecov\default.profdata .build\x86_64-unknown-windows-msvc\debug\SwiftWin32PackageTests.xctest > $env:Temp\coverage.lcov
62+
63+
- uses: codecov/[email protected]
64+
with:
65+
token: ${{ secrets.CODECOV_TOKEN }}
66+
files: $env:Temp\coverage.lcov

0 commit comments

Comments
 (0)