Skip to content

Commit bf3afe2

Browse files
committed
Merge branch 'develop' into hmac_auth
2 parents db4be5f + eb3ee55 commit bf3afe2

File tree

68 files changed

+2268
-1457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2268
-1457
lines changed

.github/workflows/build_documentation.yaml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check and Publish Documentation
1+
name: Check for Complete Documentation
22

33
on:
44
# Triggers the workflow on push or pull request events
@@ -24,7 +24,7 @@ concurrency:
2424
env:
2525
REBUILD_CACHE_NUMBER: 2
2626
PYTHON_DEPS_ARCHIVE_NUM: 2
27-
DOXYGEN_VERSION: Release_1_9_3
27+
DOXYGEN_VERSION: Release_1_9_4
2828
TEX_VERSION: 2019
2929
# ^^ 2019 is the latest TeX live available on apt-get and that's good enough
3030
GRAPHVIZ_VERSION: 2.43.0
@@ -33,6 +33,7 @@ jobs:
3333
check_menu_inclusion:
3434
runs-on: ubuntu-latest
3535
if: "!contains(github.event.head_commit.message, 'ci skip')"
36+
name: Check that all classes are documented in the menu-a-la-carte example
3637

3738
steps:
3839
- uses: actions/checkout@v3
@@ -42,14 +43,44 @@ jobs:
4243
with:
4344
python-version: '3.x'
4445

46+
# Using anwer from here to get the exit code and pass the output: https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions
4547
- name: check for classes in the menu example
48+
id: check_component
49+
continue-on-error: true
4650
run: |
4751
cd $GITHUB_WORKSPACE/continuous_integration
48-
python check_component_inclusion.py
52+
python check_component_inclusion.py 2>&1 | tee check_component.log
53+
result_code=${PIPESTATUS[0]}
54+
missing_menu_docs=$(cat check_component.log)
55+
missing_menu_docs="${missing_menu_docs//'%'/'%25'}"
56+
missing_menu_docs="${missing_menu_docs//$'\n'/'%0A'}"
57+
missing_menu_docs="${missing_menu_docs//$'\r'/'%0D'}"
58+
echo "missing_menu_docs=missing_menu_docs" >> $GITHUB_OUTPUT
59+
if [[ $result_code ]]; then
60+
echo "$(cat check_component.log)" >> $GITHUB_STEP_SUMMARY
61+
else
62+
echo "Valid library.json =)" >> $GITHUB_STEP_SUMMARY
63+
fi
64+
echo "Finished menu inclusion verification"
65+
exit $result_code
66+
67+
- name: Create commit comment
68+
uses: peter-evans/commit-comment@v2
69+
if: steps.check_component.outcome=='failure'
70+
with:
71+
body: |
72+
All sensor and variable subclasses must be included in the Menu a la Carte example
73+
${{ steps.check_component.outputs.missing_menu_docs }}
74+
75+
- name: Fail if cannot find all menu flags
76+
id: verification_failure
77+
if: steps.check_component.outcome=='failure'
78+
run: exit 1
4979

5080
doc_build:
5181
runs-on: ubuntu-latest
5282
if: "!contains(github.event.head_commit.message, 'ci skip')"
83+
name: Build documentation
5384

5485
steps:
5586
# check out the ModularSensors repo
@@ -86,8 +117,6 @@ jobs:
86117

87118
- name: Build and install doxygen and its dependencies
88119
if: steps.cache_doxygen.outputs.cache-hit != 'true'
89-
env:
90-
TRAVIS_BUILD_DIR: ${{ github.workspace }}
91120
run: |
92121
cd ${{ github.workspace }}/code_docs/ModularSensors/
93122
chmod +x continuous_integration/build-install-doxygen.sh
@@ -102,16 +131,25 @@ jobs:
102131
path: code_docs/m.css
103132

104133
- name: Generate all the documentation
105-
env:
106-
TRAVIS_BUILD_DIR: ${{ github.workspace }}
134+
continue-on-error: true
107135
run: |
108136
cd ${{ github.workspace }}/code_docs/ModularSensors/
109137
chmod +x continuous_integration/generate-documentation.sh
110-
sh continuous_integration/generate-documentation.sh
138+
sh continuous_integration/generate-documentation.sh 2>&1 | tee doxygen_run_output.log
139+
result_code=${PIPESTATUS[0]}
140+
echo "doxygen_warnings=$(cat docs/output_doxygen.log)" >> $GITHUB_OUTPUT
141+
echo "mcss_warnings=$(cat docs/output_mcss.log)" >> $GITHUB_OUTPUT
142+
echo "## Doxygen completed with the following warnings:" >> $GITHUB_STEP_SUMMARY
143+
echo "$(cat docs/output_doxygen.log)" >> $GITHUB_STEP_SUMMARY
144+
echo "" >> $GITHUB_STEP_SUMMARY
145+
echo "## mcss Doxygen post-processing completed with the following warnings:" >> $GITHUB_STEP_SUMMARY
146+
echo "$(cat docs/output_mcss.log)" >> $GITHUB_STEP_SUMMARY
147+
echo "Finished generating documentation"
148+
exit $result_code
111149
112150
- name: Deploy to github pages
113151
if: "(github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')"
114-
uses: peaceiris/actions-gh-pages@v3.8.0
152+
uses: peaceiris/actions-gh-pages@v3.9.0
115153
with:
116154
github_token: ${{ secrets.GITHUB_TOKEN }}
117155
publish_dir: ${{ github.workspace }}/code_docs/ModularSensorsDoxygen/m.css

.github/workflows/build_examples.yaml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Build Examples
2+
3+
# Triggers the workflow on push or pull request events
4+
on: [push, pull_request]
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
generate_matrix:
12+
name: Generate build matrices
13+
runs-on: ubuntu-latest
14+
if: "!contains(github.event.head_commit.message, 'ci skip')"
15+
outputs:
16+
arduino_job_matrix: ${{ steps.py_matrix.outputs.arduino_job_matrix }}
17+
pio_job_matrix: ${{ steps.py_matrix.outputs.pio_job_matrix }}
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.x'
26+
cache: 'pip'
27+
28+
- name: Install python dependencies, including PlatformIO
29+
run: pip install -r continuous_integration/requirements.txt
30+
31+
- name: Generate Matrices
32+
id: py_matrix
33+
run: |
34+
python continuous_integration/generate_job_matrix.py
35+
36+
- name: Store generated examples
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: generated_examples
40+
path: |
41+
continuous_integration_artifacts/
42+
43+
build_ex_arduino:
44+
name: ${{ matrix.job_info.job_name }}
45+
runs-on: ubuntu-latest
46+
needs: generate_matrix
47+
strategy:
48+
matrix:
49+
job_info: ${{ fromJSON(needs.generate_matrix.outputs.arduino_job_matrix) }}
50+
51+
steps:
52+
- uses: actions/checkout@v3
53+
54+
- name: Set environment variable for library installation source
55+
run: |
56+
if [[ -z "${GITHUB_HEAD_REF}" ]]; then
57+
echo "::debug::Push to commit ${GITHUB_SHA}"
58+
echo "LIBRARY_INSTALL_ZIP=https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.zip" >> $GITHUB_ENV
59+
else
60+
echo "::debug::Pull Request from the ${GITHUB_HEAD_REF} branch"
61+
echo "LIBRARY_INSTALL_ZIP=https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_HEAD_REF}.zip" >> $GITHUB_ENV
62+
fi
63+
64+
- name: Unused Step
65+
run: echo "This is needed to make the step number match with the PlatformIO jobs. =)"
66+
67+
# We use the `arduino/setup-arduino-cli` action to install and
68+
# configure the Arduino CLI on the system.
69+
- name: Setup Arduino CLI
70+
uses: arduino/setup-arduino-cli@v1.1.1
71+
72+
- name: Restore Arduino platforms and libraries
73+
uses: actions/cache@v3
74+
id: cache_libraries
75+
with:
76+
path: |
77+
home/arduino
78+
# if nothing in the dependencies.json file has changed, then it will
79+
# be a "cache hit" and we can restore libraries from cache and not
80+
# download them. If it has changed we have to re-download.
81+
key: ${{ hashFiles('./continuous_integration/dependencies.json','continuous_integration/install-deps-arduino-cli.sh') }}
82+
83+
# Install cores and library dependencies for the Arduino CLI, iff no cache
84+
- name: Install the Arduino libraries
85+
if: steps.cache_libraries.outputs.cache-hit != 'true'
86+
run: |
87+
chmod +x continuous_integration/install-deps-arduino-cli.sh
88+
sh continuous_integration/install-deps-arduino-cli.sh
89+
90+
# Install ModularSensors for the Arduino CLI
91+
- name: Install the testing version of Modular Sensors for the Arduino CLI
92+
run: |
93+
chmod +x continuous_integration/install-test-version-arduino-cli.sh
94+
sh continuous_integration/install-test-version-arduino-cli.sh
95+
96+
- name: Download the prepared examples
97+
uses: actions/download-artifact@v3
98+
with:
99+
name: generated_examples
100+
path: |
101+
continuous_integration_artifacts/
102+
103+
- name: Include problem matcher
104+
uses: ammaraskar/gcc-problem-matcher@master
105+
106+
# Run the script to compile the examples
107+
- name: Compile
108+
env:
109+
ACTION_RUN_ID: ${{ github.run_id }}
110+
run: |
111+
chmod +x ${{ matrix.job_info.script }}
112+
bash ${{ matrix.job_info.script }}
113+
114+
# NOTE: Don't uninstall for PlatformIO because the library manager will clean up the
115+
# dependencies leaving nothing for the cache
116+
# pio pkg uninstall --library -g EnviroDIY_ModularSensors
117+
- name: Uninstall testing version of Modular Sensors before caching
118+
run: |
119+
arduino-cli --config-file continuous_integration/arduino_cli.yaml lib uninstall ModularSensors
120+
121+
build_pio:
122+
name: ${{ matrix.job_info.job_name }}
123+
runs-on: ubuntu-latest
124+
needs: generate_matrix
125+
strategy:
126+
matrix:
127+
job_info: ${{ fromJSON(needs.generate_matrix.outputs.pio_job_matrix) }}
128+
129+
steps:
130+
- uses: actions/checkout@v3
131+
132+
- name: Set environment variable for library installation source
133+
run: |
134+
if [[ -z "${GITHUB_HEAD_REF}" ]]; then
135+
echo "::debug::Push to commit ${GITHUB_SHA}"
136+
echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_SHA}" >> $GITHUB_ENV
137+
else
138+
echo "::debug::Pull Request from the ${GITHUB_HEAD_REF} branch"
139+
echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_HEAD_REF}" >> $GITHUB_ENV
140+
fi
141+
142+
- name: Set up Python
143+
uses: actions/setup-python@v4
144+
with:
145+
python-version: '3.x'
146+
cache: 'pip'
147+
148+
- name: Install python dependencies, including PlatformIO
149+
run: pip install -r continuous_integration/requirements.txt
150+
151+
- name: Restore PlatformIO and Arduino platforms and libraries
152+
uses: actions/cache@v3
153+
id: cache_libraries
154+
with:
155+
path: |
156+
~/.platformio
157+
# if nothing in the dependencies.json file has changed, then it will
158+
# be a "cache hit" and we can restore libraries from cache and not
159+
# download them. If it has changed we have to re-download.
160+
key: ${{ hashFiles('./continuous_integration/dependencies.json','continuous_integration/install-deps-platformio.sh') }}
161+
162+
# Install the dependencies for PlatformIO
163+
- name: Install the PlatformIO dependencies at global level
164+
if: steps.cache_libraries.outputs.cache-hit != 'true'
165+
run: |
166+
chmod +x continuous_integration/install-deps-platformio.sh
167+
sh continuous_integration/install-deps-platformio.sh
168+
cp -a /home/runner/.platformio/lib/. $GITHUB_WORKSPACE/lib/
169+
170+
# Install ModularSensors at the Global level for PlatformIO
171+
# Force install to get the right version
172+
- name: Install the testing version of Modular Sensors for PlatformIO
173+
run: |
174+
pio pkg install -g --library ${{ env.LIBRARY_INSTALL_SOURCE }}
175+
176+
- name: Download the prepared examples
177+
uses: actions/download-artifact@v3
178+
with:
179+
name: generated_examples
180+
path: |
181+
continuous_integration_artifacts/
182+
183+
- name: Include problem matcher
184+
uses: ammaraskar/gcc-problem-matcher@master
185+
186+
# Run the script to compile the examples
187+
- name: Compile
188+
env:
189+
ACTION_RUN_ID: ${{ github.run_id }}
190+
run: |
191+
chmod +x ${{ matrix.job_info.script }}
192+
bash ${{ matrix.job_info.script }}

0 commit comments

Comments
 (0)