-
Notifications
You must be signed in to change notification settings - Fork 1.5k
121 lines (101 loc) · 3.98 KB
/
CI-windows.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
# Some convenient links:
# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
#
name: CI-windows
on:
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
defaults:
run:
shell: cmd
# TODO: choose/add a step to bail out on compiler warnings (maybe even the release build)
jobs:
build:
strategy:
matrix:
os: [windows-2022]
config: [release]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
# see https://www.pcre.org/original/changelog.txt
PCRE_VERSION: 8.45
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
if: matrix.config == 'release'
uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true
- name: Set up Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Cache PCRE
id: cache-pcre
uses: actions/cache@v3
with:
path: |
externals\pcre.h
externals\pcre.lib
externals\pcre64.lib
key: pcre-${{ env.PCRE_VERSION }}-x64-bin-win
- name: Download PCRE
if: steps.cache-pcre.outputs.cache-hit != 'true'
run: |
curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel!
- name: Install PCRE
if: steps.cache-pcre.outputs.cache-hit != 'true'
run: |
7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel!
cd pcre-%PCRE_VERSION% || exit /b !errorlevel!
cmake . -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPCRE_BUILD_PCRECPP=Off -DPCRE_BUILD_TESTS=Off -DPCRE_BUILD_PCREGREP=Off || exit /b !errorlevel!
nmake || exit /b !errorlevel!
copy pcre.h ..\externals || exit /b !errorlevel!
copy pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel!
env:
CL: /MP
- name: Install missing Python packages
if: matrix.config == 'release'
run: |
python -m pip install pip --upgrade || exit /b !errorlevel!
python -m pip install pytest || exit /b !errorlevel!
python -m pip install pytest-custom_exit_code || exit /b !errorlevel!
python -m pip install pytest-timeout || exit /b !errorlevel!
- name: Run CMake
if: false # TODO: enable
run: |
cmake -S . -B build -DBUILD_TESTS=On || exit /b !errorlevel!
- name: Build CLI debug configuration using MSBuild
if: matrix.config == 'debug'
run: |
:: cmake --build build --target check --config Debug || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel!
- name: Run Debug test
if: matrix.config == 'debug'
run: .\bin\debug\testrunner.exe || exit /b !errorlevel!
- name: Build CLI release configuration using MSBuild
if: matrix.config == 'release'
run: |
:: cmake --build build --target check --config Release || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel!
- name: Run test/cli
if: matrix.config == 'release'
run: |
:: since FILESDIR is not set copy the binary to the root so the addons are found
:: copy .\build\bin\Release\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel!
copy .\bin\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel!
copy .\bin\cppcheck-core.dll .\cppcheck-core.dll || exit /b !errorlevel!
cd test/cli || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv || exit /b !errorlevel!
set TEST_CPPCHECK_INJECT_J=2
python -m pytest -Werror --strict-markers -vv || exit /b !errorlevel!
set TEST_CPPCHECK_INJECT_J=