-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (116 loc) · 5.39 KB
/
Copy pathmain.yml
File metadata and controls
134 lines (116 loc) · 5.39 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Build
on: # Run the workflow for each of the following events:
push: # - A branch is pushed or updated.
paths-ignore:
- 'README.md'
pull_request: # - A pull-request is opened or updated.
paths-ignore:
- 'README.md'
workflow_dispatch: # - A manual run of the workflow is requested from the GitHub web interface.
release:
types: [created] # - A release is created.
jobs:
main:
strategy:
fail-fast: false # Don't stop all the workflows when one of them fails.
matrix:
os: [ubuntu-22.04, windows-latest, macos-14] # List of GitHub Actions platform to run the workflow on
env:
# For WolfSSL:
# set the value of the environment variable OS to Windows when running on the Windows operating system and to Linux_Or_Mac otherwise
OS: ${{ matrix.os == 'windows-latest' && 'Windows' || 'Linux_Or_Mac' }}
# On Windows, the validation profile fails due to "(style) incorrect line terminator [-gnatyd]"
PROFILE: ${{ matrix.os == 'windows-latest' && 'development' || 'validation' }}
# Switches to enable code coverage with gcov
COVERAGE_SWITCHES: "-XCOVERAGE=gcov -cargs -O0 -fno-inline --coverage -largs --coverage"
runs-on: ${{ matrix.os }} # Run the continuous integration workflow on each OS listed in the matrix.
steps:
# Check-out the repository
- uses: actions/checkout@v2
with:
submodules: 'true' # Also checkout recursively the submodules
# Install and setup Alire package manager
- uses: alire-project/setup-alire@v2
with:
version: 2.1.0 # Remove this option to use the default (latest stable release)
# Build the project using the validation build profile to enforce static analysis and coding style.
- name: Build library
run: alr --non-interactive build --$PROFILE -- $COVERAGE_SWITCHES
shell: bash
# Build the test programs using the validation build profile to enforce static analysis and coding style.
- name: Build test client
run: alr -C client --non-interactive build --profiles="*=$PROFILE" -- $COVERAGE_SWITCHES
shell: bash
- name: Build test server
run: alr -C server --non-interactive build --profiles="*=$PROFILE" -- $COVERAGE_SWITCHES
shell: bash
# Install binary crates needed for testing
- name: Install binary crates
run: |
git clone --depth 1 https://github.com/LionelDraghi/bbt.git
alr --non-interactive -C bbt install
shell: bash
# Run the instrumented testsuite. This will produce *.gcno and *.gcda files for the coverage analysis.
- name: Library Aunit tests
run: |
cd tests
alr --non-interactive build --profiles="*=$PROFILE" -- $COVERAGE_SWITCHES
echo "## Aunit test results" >> $GITHUB_STEP_SUMMARY
NO_COLOR=1 bin/tests >> $GITHUB_STEP_SUMMARY
shell: bash
# On Linux we can run all the testsuite, after installing coap-server-openssl from libcoap3-bin package.
- if: runner.os == 'Linux'
name: Client tests (CoAP and secure CoAP)
run: |
sudo apt install libcoap3-bin
PATH=$HOME/.alire/bin:$PATH make -C client/tests
shell: bash
# On Windows and macOS we can only run the plain CoAP tests.
- if: runner.os == 'Windows' || runner.os == 'macOS'
name: Client tests (CoAP only)
run: PATH=$HOME/.alire/bin:$PATH make -C client/tests coap_results.md
shell: bash
# Run server tests
- if: runner.os == 'Windows' || runner.os == 'Linux'
name: Server tests
run: |
PATH=$HOME/.alire/bin:$PATH make -C server/tests
shell: bash
- if: runner.os == 'macOS'
name: Server tests (CoAP only on macOS)
run: |
PATH=$HOME/.alire/bin:$PATH make -C server/tests coap_results.md
shell: bash
- name: CoAP test results
run: cat client/tests/coap*_results.md server/tests/coap*_results.md >> $GITHUB_STEP_SUMMARY
shell: bash
# Run gcov on the library, the tests and the test programs. This will produce *.gcov files.
# The library source files are splitted in parts, otherwise gcov fails with
# an unexpected error.
- name: Run gcov
run: |
alr exec -- gcov -o obj/$PROFILE src/rflx*.ad[sb]
alr exec -- gcov -o obj/$PROFILE src/coap_spark*.ad[sb] src/workarounds.ad[sb]
for dir in tests client server
do
cd $dir
alr exec -- gcov -o obj/$PROFILE src/*.ad[sb]
cd -
done
shell: bash
# Upload results to codecov.io
- if: runner.os == 'Linux'
name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true # optional (default = false)
name: codecov-umbrella # optional
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: server/tests/coap_results.xml,server/tests/coaps_results.xml,client/tests/coap_results.xml,client/tests/coaps_results.xml
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results