Skip to content

Commit

Permalink
Use build examples workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Sara Damiano <[email protected]>
  • Loading branch information
SRGDamia1 committed Aug 9, 2024
1 parent 1ff8b3c commit 5b6ab84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 238 deletions.
237 changes: 7 additions & 230 deletions .github/workflows/build_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,233 +8,10 @@ concurrency:
cancel-in-progress: true

jobs:
generate_matrix:
name: Generate build matrices
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
outputs:
arduino_job_matrix: ${{ steps.py_matrix.outputs.arduino_job_matrix }}
pio_job_matrix: ${{ steps.py_matrix.outputs.pio_job_matrix }}

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'

- name: Install python dependencies, including PlatformIO
run: pip install -r continuous_integration/requirements.txt

- name: Generate Matrices
id: py_matrix
run: |
python continuous_integration/generate_job_matrix.py
- name: Store generated examples
uses: actions/upload-artifact@v4
with:
name: generated_examples
path: |
continuous_integration_artifacts/
print_job_matrix:
name: print_job_matrix
runs-on: ubuntu-latest
needs: generate_matrix
steps:
- name: Check the generated matrix output
run: |
echo "Arduino job matrix:"
echo "${{ needs.generate_matrix.outputs.arduino_job_matrix }}"
echo
echo "PlatformIO job matrix"
echo "${{ needs.generate_matrix.outputs.pio_job_matrix }}"
determine_library_source:
name: determine_library_source
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
outputs:
library_install_zip: ${{ steps.store_vars.outputs.library_install_zip }}
library_install_git: ${{ steps.store_vars.outputs.library_install_git }}

steps:
- uses: actions/checkout@v4

- name: Set environment variables for pushes to any branch in EnviroDIY/ModularSensors
if: github.event_name == 'push'
run: |
echo "Push to commit ${GITHUB_SHA}"
echo "LIBRARY_INSTALL_ZIP=https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.zip" >> $GITHUB_ENV
echo "LIBRARY_INSTALL_GIT=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set environment variable for PR's from any branch in EnviroDIY/ModularSensors
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.name == github.repository
run: |
echo "Pull Request from the ${GITHUB_HEAD_REF} branch"
echo "LIBRARY_INSTALL_ZIP=https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_HEAD_REF}.zip" >> $GITHUB_ENV
echo "LIBRARY_INSTALL_GIT=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Set environment variable for PR's from any branch in EnviroDIY/ModularSensors
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.name != github.repository
run: |
echo "Pull Request from the fork ${{ github.event.pull_request.head.repo.full_name }} at ${{ github.event.pull_request.head.ref }}"
echo "LIBRARY_INSTALL_ZIP=https://github.com/${{ github.event.pull_request.head.repo.full_name }}/archive/${{ github.event.pull_request.head.ref }}.zip" >> $GITHUB_ENV
echo "LIBRARY_INSTALL_GIT=https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git#${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
- name: store enviroment variables as output
id: store_vars
run: |
echo "library_install_zip=${{ env.LIBRARY_INSTALL_ZIP }}" >> $GITHUB_OUTPUT
echo "library_install_git=${{ env.LIBRARY_INSTALL_GIT }}" >> $GITHUB_OUTPUT
print_library_source:
name: print_library_source
runs-on: ubuntu-latest
needs: determine_library_source
steps:
- name: Check the library installation source
run: |
echo "Link to zip for Arduino CLI testing install:"
echo "${{ needs.determine_library_source.outputs.library_install_zip }}"
echo
echo "Git reference for PlatformIO testing install"
echo "${{ needs.determine_library_source.outputs.library_install_git }}"
build_ex_arduino:
name: ${{ matrix.job_info.job_name }}
runs-on: ubuntu-latest
needs: [generate_matrix, determine_library_source]
env:
LIBRARY_INSTALL_ZIP: ${{ needs.determine_library_source.outputs.library_install_zip }}
strategy:
matrix:
job_info: ${{ fromJSON(needs.generate_matrix.outputs.arduino_job_matrix) }}

steps:
- uses: actions/checkout@v4

- name: Unused Step
run: echo "This is needed to make the step number match with the PlatformIO jobs. =)"

# We use the `arduino/setup-arduino-cli` action to install and
# configure the Arduino CLI on the system.
- name: Setup Arduino CLI
uses: arduino/[email protected]

- name: Restore Arduino platforms and libraries
uses: actions/cache@v4
id: cache_libraries
with:
path: |
home/arduino
# if nothing in the dependencies.json file has changed, then it will
# be a "cache hit" and we can restore libraries from cache and not
# download them. If it has changed we have to re-download.
key: ${{ hashFiles('./continuous_integration/dependencies.json','continuous_integration/install-deps-arduino-cli.sh') }}

# Install cores and library dependencies for the Arduino CLI, iff no cache
- name: Install the Arduino libraries
if: steps.cache_libraries.outputs.cache-hit != 'true'
run: |
chmod +x continuous_integration/install-deps-arduino-cli.sh
sh continuous_integration/install-deps-arduino-cli.sh
# Install ModularSensors for the Arduino CLI
- name: Install the testing version of Modular Sensors for the Arduino CLI
run: |
chmod +x continuous_integration/install-test-version-arduino-cli.sh
sh continuous_integration/install-test-version-arduino-cli.sh
- name: Download the prepared examples
uses: actions/download-artifact@v4
with:
name: generated_examples
path: |
continuous_integration_artifacts/
- name: Include problem matcher
uses: ammaraskar/gcc-problem-matcher@master

# Run the script to compile the examples
- name: Compile
env:
ACTION_RUN_ID: ${{ github.run_id }}
run: |
chmod +x ${{ matrix.job_info.script }}
bash ${{ matrix.job_info.script }}
# NOTE: Don't uninstall for PlatformIO because the library manager will clean up the
# dependencies leaving nothing for the cache
# pio pkg uninstall --library -g EnviroDIY_ModularSensors
- name: Uninstall testing version of Modular Sensors before caching
run: |
arduino-cli --config-file continuous_integration/arduino_cli.yaml lib uninstall ModularSensors
build_pio:
name: ${{ matrix.job_info.job_name }}
runs-on: ubuntu-latest
needs: [generate_matrix, determine_library_source]
env:
LIBRARY_INSTALL_GIT: ${{ needs.determine_library_source.outputs.library_install_git }}
strategy:
matrix:
job_info: ${{ fromJSON(needs.generate_matrix.outputs.pio_job_matrix) }}

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'

- name: Install python dependencies, including PlatformIO
run: pip install -r continuous_integration/requirements.txt

- name: Restore PlatformIO platforms and libraries
uses: actions/cache@v4
id: cache_libraries
with:
path: |
~/.platformio
# if nothing in the dependencies.json file has changed, then it will
# be a "cache hit" and we can restore libraries from cache and not
# download them. If it has changed we have to re-download.
key: ${{ hashFiles('./continuous_integration/dependencies.json','continuous_integration/install-deps-platformio.sh') }}

# Install the dependencies for PlatformIO
- name: Install the PlatformIO dependencies at global level
if: steps.cache_libraries.outputs.cache-hit != 'true'
run: |
chmod +x continuous_integration/install-deps-platformio.sh
sh continuous_integration/install-deps-platformio.sh
cp -a /home/runner/.platformio/lib/. $GITHUB_WORKSPACE/lib/
# Install ModularSensors at the Global level for PlatformIO
# Force install to get the right version
- name: Install the testing version of Modular Sensors for PlatformIO
run: |
pio pkg install -g --library ${{ env.LIBRARY_INSTALL_GIT }}
- name: Download the prepared examples
uses: actions/download-artifact@v4
with:
name: generated_examples
path: |
continuous_integration_artifacts/
- name: Include problem matcher
uses: ammaraskar/gcc-problem-matcher@master

# Run the script to compile the examples
- name: Compile
env:
ACTION_RUN_ID: ${{ github.run_id }}
run: |
chmod +x ${{ matrix.job_info.script }}
bash ${{ matrix.job_info.script }}
build_examples:
name: Build all examples with PlatformIO and the Arduino CLI
if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }}
uses: EnviroDIY/workflows/.github/workflows/build_examples.yaml@main
with:
boards_to_build: 'mayfly,megaatmega2560,zeroUSB,adafruit_feather_m0'
secrets: inherit
12 changes: 6 additions & 6 deletions continuous_integration/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ build_flags =
-D SDI12_EXTERNAL_PCINT
-D NEOSWSERIAL_EXTERNAL_PCINT

[env:Mayfly]
[env:mayfly]
board = mayfly
platform = atmelavr
lib_ignore =
Expand All @@ -36,7 +36,7 @@ lib_ignore =
build_flags =
${env.build_flags}

[env:Mega]
[env:mega]
platform = atmelavr
board = megaatmega2560
lib_ignore =
Expand All @@ -46,7 +46,7 @@ lib_ignore =
build_flags =
${env.build_flags}

[env:Zero]
[env:zero]
platform = atmelsam
board = zeroUSB
lib_ignore =
Expand All @@ -58,7 +58,7 @@ lib_ignore =
build_flags =
${env.build_flags}

[env:FeatherM0]
[env:feather_m0]
platform = atmelsam
board = adafruit_feather_m0
lib_ignore =
Expand All @@ -71,7 +71,7 @@ build_flags =
${env.build_flags}
build_unflags = -D USE_TINYUSB

; [env:FeatherM4]
; [env:feather_m4]
; platform = atmelsam
; board = adafruit_feather_m4
; lib_ignore =
Expand All @@ -86,7 +86,7 @@ build_unflags = -D USE_TINYUSB
; -D MS_SAMD_DS3231
; build_unflags = -D USE_TINYUSB

; [env:GrandCentralM4]
; [env:grandcentral_m4]
; platform = atmelsam
; board = adafruit_grandcentral_m4
; lib_ignore =
Expand Down
4 changes: 2 additions & 2 deletions src/sensors/GroPointGPLP8.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
* Profiling Probe. Classes for the GroPoint Profile GPLP-8 Soil Moisture &
* Temperature Probe.
*
* @ingroup GroPoint_group
* @ingroup gropoint_group
*
* @tableofcontents
* @m_footernavigation
*
* @section sensor_gplp8_datasheet Sensor Datasheet
* - [GroPoint Profile User Manual](https://www.gropoint.com/s/2625-N-T-GroPoint-Profile-User-Manual-V113.pdf), including Modbus Instructions.
* - [GroPoint Profile Technical Info](https://www.gropoint.com/s/GroPoint-Profile-Technical-Info.pdf)
* *
*
* @section sensor_gplp8_ctor Sensor Constructor
* {{ @ref GroPointGPLP8::GroPointGPLP8 }}
*
Expand Down

1 comment on commit 5b6ab84

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint_errors

Please sign in to comment.