File tree Expand file tree Collapse file tree 6 files changed +50
-13
lines changed Expand file tree Collapse file tree 6 files changed +50
-13
lines changed Original file line number Diff line number Diff line change 48
48
sudo apt install -y asciidoctor
49
49
sudo gem install asciidoctor asciidoctor-diagram rouge
50
50
51
- - name : Install cmake-format
52
- run : |
53
- pipx install cmakelang
54
- pipx inject cmakelang pyyaml
55
-
56
- - name : Install python quality tools
57
- run : |
58
- pipx install pytest
59
- pipx inject pytest pytest-xdist hypothesis
60
- pipx install mypy
61
- pipx install black
62
- echo "/opt/pipx_bin" >> $GITHUB_PATH
63
-
64
51
- name : Checkout target branch
65
52
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66
53
with :
73
60
- name : Checkout PR branch
74
61
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
75
62
63
+ - name : Install python test requirements
64
+ run : |
65
+ python3 -m venv ${{github.workspace}}/test_venv
66
+ source ${{github.workspace}}/test_venv/bin/activate
67
+ pip install -r ${{github.workspace}}/requirements.txt
68
+ echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
69
+
70
+ - name : Install cmake-format
71
+ run : |
72
+ pip install cmakelang pyyaml
73
+
74
+ - name : Install python quality tools
75
+ run : |
76
+ pip install mypy black
77
+
76
78
- name : Restore CPM cache
77
79
env :
78
80
cache-name : cpm-cache-0
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ option(INFRA_PROVIDE_CLANG_TIDY "Provide .clang-tidy file" ON)
26
26
option (INFRA_PROVIDE_CMAKE_FORMAT "Provide .cmake-format.yaml file" ON )
27
27
option (INFRA_PROVIDE_PRESETS "Provide cmake presets and toolchains" ON )
28
28
option (INFRA_PROVIDE_MULL "Provide mull.yml file" ON )
29
+ option (INFRA_PROVIDE_PYTEST_REQS
30
+ "Provide pip requirements.txt for python tests" ON )
29
31
option (INFRA_PROVIDE_GITIGNORE "Add provided things to .gitignore" ON )
30
32
option (INFRA_USE_SYMLINKS "Use symlinks to provide common files" ON )
31
33
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ function(make_gitignore)
41
41
list (APPEND GITIGNORE_CONTENTS "mull.yml" )
42
42
endif ()
43
43
endif ()
44
+ if (INFRA_PROVIDE_PYTEST_REQS)
45
+ if (NOT EXISTS "${CMAKE_SOURCE_DIR} /requirements.txt" )
46
+ list (APPEND GITIGNORE_CONTENTS "requirements.txt" )
47
+ endif ()
48
+ endif ()
44
49
endif ()
45
50
46
51
string (REPLACE ";" "\n " GITIGNORE_CONTENTS "${GITIGNORE_CONTENTS} " )
@@ -112,6 +117,9 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
112
117
if (INFRA_PROVIDE_MULL)
113
118
put_in_project_dir("mull.yml" )
114
119
endif ()
120
+ if (INFRA_PROVIDE_PYTEST_REQS)
121
+ put_in_project_dir("requirements.txt" )
122
+ endif ()
115
123
116
124
if (INFRA_PROVIDE_GITHUB_WORKFLOWS)
117
125
execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ level, and a `toolchains` directory.
30
30
31
31
When `ON`, this repository provides a `mull.yml` file at the root level.
32
32
33
+ *`INFRA_PROVIDE_PYTEST_REQS`*
34
+
35
+ When `ON`, this repository provides a `requirements.txt` file at the root level.
36
+ When used with `pip install -r requirements.txt` this provides the packages
37
+ sufficient to run python tests.
38
+
33
39
*`INFRA_PROVIDE_GITIGNORE`*
34
40
35
41
When `ON`, this repository provides a `.gitignore` file at the root level. It
Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ dependencies that are not part of the CMake dependency tree. A `conftest.py`
68
68
file in the same directory as any of the `FILE`s is automatically discovered as
69
69
such a dependency.
70
70
71
+ NOTE: Python tests use several testing packages; these can be installed using
72
+ `requirements.txt` which is provided through the `INFRA_PROVIDE_PYTEST_REQS`
73
+ option.
74
+
71
75
=== Fuzz tests
72
76
73
77
[source,cmake]
Original file line number Diff line number Diff line change
1
+ # The contents of this file can be generated at latest versions available by running:
2
+ #
3
+ # $ python3 -m venv ./test_venv
4
+ # $ source ./test_venv/bin/activate
5
+ # $ pip install pytest pytest-xdist hypothesis | tail -n1 | cut -d' ' -f 3- | tr ' ' '\n' | sed 's/\(.*\)-\(.*\)/\1==\2/'
6
+ #
7
+ attrs == 24.2.0
8
+ execnet == 2.1.1
9
+ hypothesis == 6.115.3
10
+ iniconfig == 2.0.0
11
+ packaging == 24.1
12
+ pluggy == 1.5.0
13
+ pytest == 8.3.3
14
+ pytest-xdist == 3.6.1
15
+ sortedcontainers == 2.4.0
You can’t perform that action at this time.
0 commit comments