Skip to content

Commit 56096a7

Browse files
committed
Made compilation a matrix.
1 parent 6ebb28e commit 56096a7

5 files changed

Lines changed: 96 additions & 15 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=lf

.github/workflows/Pipeline.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ jobs:
8989
wheel: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
9090
apptest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).apptesting_xml }}
9191

92-
C_Example:
92+
Examples:
9393
runs-on: ubuntu-24.04
9494
needs:
9595
- UnitTestingParams
9696
- Package
97+
strategy:
98+
matrix:
99+
example: ["C", "CXX"]
97100
defaults:
98101
run:
99102
shell: bash
@@ -112,26 +115,20 @@ jobs:
112115
ls -l install
113116
python -m pip install -U --disable-pip-version-check --break-system-packages install/*.whl
114117
115-
- name: Generate versioning.c
118+
- name: Generate versioning.${{ matrix.fileext }}
116119
run: |
117-
cd example/C
118-
pyVersioning fillout ../../templates/C/versioning.c.template versioning.c
119-
cd ../CXX
120-
pyVersioning fillout ../../templates/CXX/versioning.cpp.template versioning.cpp
120+
cd example
121+
./fillout.sh ${{ matrix.example }}
121122
122123
- name: Compile example
123124
run: |
124-
cd example/C
125-
gcc -o example example.c versioning.c
126-
cd ../CXX
127-
g++ -o example example.cpp versioning.cpp
125+
cd example
126+
./build.sh ${{ matrix.example }}
128127
129128
- name: Execute example
130129
run: |
131-
cd example/C
132-
./example
133-
cd ../CXX
134-
./example
130+
cd example
131+
./check.sh ${{ matrix.example }}
135132
136133
PublishCoverageResults:
137134
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@r4
@@ -216,7 +213,7 @@ jobs:
216213
if: startsWith(github.ref, 'refs/tags')
217214
needs:
218215
- AppTesting
219-
- C_Example
216+
- Examples
220217
- PublishToGitHubPages
221218

222219
PublishOnPyPI:

example/build.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#! /bin/bash
2+
3+
exampleName="$1"
4+
5+
cd ${exampleName} || exit 1
6+
7+
case "${exampleName}" in
8+
C)
9+
gcc \
10+
-Wall \
11+
-Wextra \
12+
-Wundef \
13+
-Wpointer-arith \
14+
-Wcast-align \
15+
-Wstrict-prototypes \
16+
-Wstrict-overflow=5 \
17+
-Wwrite-strings \
18+
-Waggregate-return \
19+
-Wcast-qual \
20+
-Wswitch-enum \
21+
-Wconversion \
22+
-Wunreachable-code \
23+
-o example \
24+
example.c versioning.c
25+
;;
26+
CXX)
27+
g++ \
28+
-Wall \
29+
-Wextra \
30+
-Wundef \
31+
-Wpointer-arith \
32+
-Wcast-align \
33+
-Wstrict-prototypes \
34+
-Wstrict-overflow=5 \
35+
-Wwrite-strings \
36+
-Waggregate-return \
37+
-Wcast-qual \
38+
-Wswitch-enum \
39+
-Wconversion \
40+
-Wunreachable-code \
41+
-o example \
42+
example.cpp versioning.cpp
43+
;;
44+
*)
45+
printf "Unknown example '%s'\n" "${exampleName}"
46+
;;
47+
esac

example/check.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /bin/bash
2+
3+
exampleName="$1"
4+
5+
cd ${exampleName} || exit 1
6+
7+
case "${exampleName}" in
8+
C)
9+
./example
10+
./example | grep version
11+
;;
12+
CXX)
13+
./example
14+
./example | grep version
15+
;;
16+
*)
17+
printf "Unknown example '%s'\n" "${exampleName}"
18+
;;
19+
esac

example/fillout.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#! /bin/bash
2+
3+
exampleName="$1"
4+
5+
cd ${exampleName} || exit 1
6+
7+
case "${exampleName}" in
8+
C)
9+
pyVersioning fillout ../../templates/C/versioning.c.template versioning.c
10+
;;
11+
CXX)
12+
pyVersioning fillout ../../templates/C/versioning.cpp.template versioning.cpp
13+
;;
14+
*)
15+
printf "Unknown example '%s'\n" "${exampleName}"
16+
;;
17+
esac

0 commit comments

Comments
 (0)