-
Notifications
You must be signed in to change notification settings - Fork 811
98 lines (82 loc) · 3.66 KB
/
windows-build-and-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
name: Windows Build and Test
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Windows Build and Test
runs-on: windows-2019
env:
CRAFT_TARGET: windows-msvc2019_64-cl
COBERTURA_COVERAGE_FILE: ${{ github.workspace }}\cobertura_coverage\coverage.xml
CRAFT_MASTER_LOCATION: ${{ github.workspace }}\CraftMaster
CRAFT_MASTER_CONFIG: ${{ github.workspace }}\craftmaster.ini
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Craft Master with Nextcloud Client Deps
shell: pwsh
run: |
& cmd /C "git clone -q --depth=1 https://invent.kde.org/packaging/craftmaster.git ${{ env.CRAFT_MASTER_LOCATION }} 2>&1"
function craft() {
python "${{ env.CRAFT_MASTER_LOCATION }}\CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c $args
if($LASTEXITCODE -ne 0) {exit $LASTEXITCODE}
}
craft --add-blueprint-repository [git]https://github.com/nextcloud/desktop-client-blueprints.git
craft craft
craft --install-deps nextcloud-client
- name: Cache Install OpenCppCoverage
id: cache-install-opencppcoverage
uses: actions/cache@v4
with:
path: C:\Program Files\OpenCppCoverage
key: ${{ runner.os }}-cache-install-opencppcoverage
- name: Install OpenCppCoverage
if: steps.cache-install-opencppcoverage.outputs.cache-hit != 'true'
shell: pwsh
run: |
choco install opencppcoverage
- name: Cache Install inkscape
id: cache-install-inkscape
uses: actions/cache@v4
with:
path: C:\Program Files\inkscape
key: ${{ runner.os }}-cache-install-inkscape
- name: Install inkscape
if: steps.cache-install-inkscape.outputs.cache-hit != 'true'
shell: pwsh
run: |
choco install inkscape
- name: Setup PATH
shell: pwsh
run: |
echo "C:\Program Files\OpenCppCoverage" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{ github.workspace }}\${{ env.CRAFT_TARGET }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Compile
shell: pwsh
run: |
function craft() {
python "${{ env.CRAFT_MASTER_LOCATION }}\CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c $args
if($LASTEXITCODE -ne 0) {exit $LASTEXITCODE}
}
craft --src-dir ${{ github.workspace }} nextcloud-client
- name: Run tests
shell: pwsh
run: |
function runTestsAndCreateCoverage() {
$buildFolder = "${{ github.workspace }}\${{ env.CRAFT_TARGET }}\build\nextcloud-client\work\build"
cd $buildFolder
$binFolder = "$buildFolder\bin"
& OpenCppCoverage.exe --optimized_build --quiet --sources ${{ github.workspace }} --modules $binFolder\*.dll* --export_type cobertura:${{ env.COBERTURA_COVERAGE_FILE }} --cover_children -- ctest --output-on-failure --timeout 300
}
runTestsAndCreateCoverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ${{ github.workspace }}\cobertura_coverage
fail_ci_if_error: true