Skip to content

Commit ba0a8c2

Browse files
ejohnstownphilljj
authored andcommitted
Add a C++ build workflow
Build wolfSSH with a C++ compiler as CC and run make check, so a change that does not compile as C++ fails CI. wolfSSL is built as C. - g++ and clang++ on Ubuntu, Apple clang++ on macOS - default and --enable-all configurations, all with -Werror - clang++ also gets -Wno-deprecated for its .c-as-C++ warning
1 parent cedffb8 commit ba0a8c2

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

‎.github/workflows/cxx-check.yml‎

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: C++ Build Test
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
WOLFSSL_REF: master
16+
17+
jobs:
18+
build_wolfssl:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ ubuntu-latest, macos-latest ]
23+
name: Build wolfssl
24+
runs-on: ${{ matrix.os }}
25+
timeout-minutes: 6
26+
steps:
27+
- name: Checking cache for wolfssl
28+
uses: actions/cache@v5
29+
id: cache-wolfssl
30+
with:
31+
path: build-dir/
32+
key: wolfssh-cxx-check-wolfssl-${{ env.WOLFSSL_REF }}-${{ matrix.os }}
33+
lookup-only: true
34+
35+
- name: Checkout, build, and install wolfssl
36+
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
37+
uses: wolfSSL/actions-build-autotools-project@v1
38+
with:
39+
repository: wolfssl/wolfssl
40+
ref: ${{ env.WOLFSSL_REF }}
41+
path: wolfssl
42+
configure: --enable-all
43+
check: false
44+
install: true
45+
46+
# wolfSSL is built as C above; only wolfSSH is compiled as C++, with the
47+
# C++ compiler as CC so every .c file goes through it. clang++ warns that
48+
# compiling a .c file as C++ is deprecated, so that one warning is
49+
# turned off to keep -Werror.
50+
build_wolfssh:
51+
needs: build_wolfssl
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
target:
56+
- { os: ubuntu-latest, cc: g++, cflags: -Werror }
57+
- { os: ubuntu-latest, cc: clang++, cflags: -Werror -Wno-deprecated }
58+
- { os: macos-latest, cc: clang++, cflags: -Werror -Wno-deprecated }
59+
config: [ '', '--enable-all' ]
60+
name: Build wolfssh (${{ matrix.target.os }}, ${{ matrix.target.cc }}, ${{ matrix.config }})
61+
runs-on: ${{ matrix.target.os }}
62+
timeout-minutes: 10
63+
steps:
64+
- name: Checking cache for wolfssl
65+
uses: actions/cache@v5
66+
with:
67+
path: build-dir/
68+
key: wolfssh-cxx-check-wolfssl-${{ env.WOLFSSL_REF }}-${{ matrix.target.os }}
69+
fail-on-cache-miss: true
70+
71+
- uses: actions/checkout@v6
72+
with:
73+
path: wolfssh/
74+
75+
- name: Install autotools
76+
if: runner.os == 'macOS'
77+
run: brew install automake libtool
78+
79+
- name: autogen
80+
working-directory: ./wolfssh/
81+
run: ./autogen.sh
82+
83+
- name: configure
84+
working-directory: ./wolfssh/
85+
run: |
86+
./configure ${{ matrix.config }} \
87+
--with-wolfssl=${{ github.workspace }}/build-dir \
88+
CC=${{ matrix.target.cc }} CFLAGS="${{ matrix.target.cflags }}"
89+
90+
- name: make
91+
working-directory: ./wolfssh/
92+
run: make -j$(getconf _NPROCESSORS_ONLN)
93+
94+
- name: make check
95+
working-directory: ./wolfssh/
96+
run: make check
97+
98+
- name: Show logs on errors
99+
if: failure()
100+
working-directory: ./wolfssh/
101+
run: |
102+
cat config.log
103+
cat test-suite.log || true

0 commit comments

Comments
 (0)