Skip to content

Commit

Permalink
Merge pull request #144 from EnviroDIY/CRC
Browse files Browse the repository at this point in the history
Implement CRC and SAMD51
  • Loading branch information
SRGDamia1 authored Aug 14, 2024
2 parents e93b4c6 + 307de77 commit a4d6115
Show file tree
Hide file tree
Showing 76 changed files with 5,556 additions and 8,361 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

*.pdf binary
*.pdf export-ignore

# used to exclude files from archiving/compression

Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
interval: 'weekly'
labels:
- 'CI/CD'
commit-message:
Expand Down
138 changes: 33 additions & 105 deletions .github/workflows/build_documentation.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,39 @@
name: Build and Publish Documentation
name: Check, Build, and Publish Documentation

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
# Triggers the workflow on push or pull request events
push:
branches:
- master
# Also trigger on page_build, as well as release created events
page_build:
pull_request:
# Trigger when a release is created
# NOTE: This will only trigger if the release is created from the UI or with a personal access token
release:
types: # This configuration does not affect the page_build event above
- created

env:
DOXYGEN_VERSION: Release_1_9_1
types:
- published
# Trigger with the release workflow finishes
workflow_run:
workflows: ['Create a New Release']
types: [completed]
branches: [master]
# Also give a manual trigger
workflow_dispatch:
inputs:
publish:
description: 'Publish Documentation to GitHub Pages'
required: false
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"

steps:
# check out the Arduino-SDI-12 repo
- uses: actions/checkout@v4
with:
path: code_docs/Arduino-SDI-12

- name: Restore or Cache pip
uses: actions/cache@v4.0.2
id: cache_pip
with:
path: ~/.cache/pip
# if requirements.txt hasn't changed, then it will be a "cache hit" and pip will be restored
# if requirements.txt HAS changed, it will be a "cache miss" and a new cache of pip will be created if the job completes successfully
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Restore or Cache PlatformIO and Libraries
uses: actions/cache@v4.0.2
id: cache_pio
with:
path: ~/.platformio
# if nothing in the lock files has changed, then it will be a "cache hit"
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

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

# This should be pulled from cache, if there's not a new version
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
# Install *all* the dependencies!
# We're including the dependencies just so the includes can follow in the doxygen pre-processor
- name: Install the dependencies at global level
run: |
echo "::debug::Installing greygnome/EnableInterrupt"
pio lib -g install greygnome/EnableInterrupt
- name: Update Libraries from Cache
run: pio lib -g update

- name: Install GraphViz (dot)
run: sudo apt-get -y install graphviz

- name: Restore or Cache Doxygen
id: cache_doxygen
uses: actions/cache@v4.0.2
with:
path: doxygen-src
key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }}

- name: Clone and build doxygen
if: steps.cache_doxygen.outputs.cache-hit != 'true'
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
run: |
cd ${{ github.workspace }}/code_docs/Arduino-SDI-12/
chmod +x continuous_integration/build-install-doxygen.sh
sh continuous_integration/build-install-doxygen.sh
# This should be pulled from cache, if there's not a new version
- name: Install Pygments and other m.css requirements
run: pip3 install jinja2 Pygments beautifulsoup4

# check out my fork of m.css, for processing Doxygen output
- name: Checkout m.css
uses: actions/checkout@v4
with:
# Repository name with owner. For example, actions/checkout
repository: SRGDamia1/m.css
path: code_docs/m.css

- name: Generate all the documentation
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
run: |
cd ${{ github.workspace }}/code_docs/Arduino-SDI-12/
chmod +x continuous_integration/generate-documentation.sh
sh continuous_integration/generate-documentation.sh
- name: Deploy to github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ github.workspace }}/code_docs/Arduino-SDI-12Doxygen/m.css
doc_build:
if: ${{ (! contains(github.event.head_commit.message, 'ci skip')) && (github.event_name != 'workflow_run' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')) }}
name: Build documentation
uses: EnviroDIY/workflows/.github/workflows/build_documentation.yaml@main
with:
use_graphviz: false
publish: ${{ (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')}}
rebuild_cache_number: 1
secrets: inherit
105 changes: 27 additions & 78 deletions .github/workflows/build_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,37 @@ name: Build Examples
# Triggers the workflow on push or pull request events
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
build_examples:
name: Build standard 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,uno,megaatmega2560,leonardo,zeroUSB,arduino_nano_esp32,feather328p,feather32u4,adafruit_feather_m0,adafruit_feather_m4,huzzah,featheresp32,esp32-c3-devkitm-1,esp32-s3-devkitm-1'
examples_to_build: 'examples/a_wild_card,examples/b_address_change,examples/c_check_all_addresses,examples/d_simple_logger,examples/e_continuous_measurement,examples/f_basic_data_request,examples/g_terminal_window,examples/h_SDI-12_slave_implementation,examples/i_SDI-12_interface,examples/k_concurrent_logger,examples/l_verify_crc'
secrets: inherit


build_ext_ints:
name: Build the External Interrupt Example
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"

strategy:
matrix:
example:
[
examples/a_wild_card/,
examples/b_address_change/,
examples/c_check_all_addresses/,
examples/d_simple_logger/,
examples/e_continuous_measurement/,
examples/f_basic_data_request/,
examples/g_terminal_window/,
examples/h_SDI-12_slave_implementation/,
examples/i_SDI-12_interface/,
examples/j_external_pcint_library/,
examples/k_concurrent_logger/,
]
if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }}
env:
PLATFORMIO_BUILD_CACHE_DIR: ~/.platformio/caches

steps:
- uses: actions/checkout@v4

- name: Set variables
run: |
if [[ -z "${GITHUB_HEAD_REF}" ]]; then
echo "::debug::Push to commit ${GITHUB_SHA}"
echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_SHA}" >> $GITHUB_ENV
else
echo "::debug::Pull Request from the ${GITHUB_HEAD_REF} branch"
echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_HEAD_REF}" >> $GITHUB_ENV
fi
- name: Restore or Cache pip
uses: actions/cache@v4.0.2
with:
path: ~/.cache/pip
# if requirements.txt hasn't changed, then it will be a "cache hit" and pip will be restored
# if requirements.txt HAS changed, it will be a "cache miss" and a new cache of pip will be created if the job completes successfully
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Checkout code
uses: actions/checkout@v4

- name: Restore or Cache PlatformIO and Libraries
uses: actions/cache@v4.0.2
with:
path: ~/.platformio
# if nothing in the lock files has changed, then it will be a "cache hit" and pip will be restored
# otherwise, it will be a "cache miss" and a new cache of libraries will be created if the job completes successfully
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

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

# This should be pulled from cache, if there's not a new version
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
if: matrix.example != 'examples/j_external_pcint_library/'
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}
run: |
echo "${{ env.LIBRARY_INSTALL_SOURCE }}"
pio lib --global install ${{ env.LIBRARY_INSTALL_SOURCE }}
pio lib --global install EnableInterrupt
platformio ci --board=mayfly --board=feather32u4 --board=adafruit_feather_m0 --board=uno --board=megaatmega2560 --board=huzzah --board=featheresp32
pio lib --global uninstall SDI-12
- name: Setup PlatformIO
uses: EnviroDIY/setup-platformio-action@v1.0.2

- name: Run PlatformIO
if: matrix.example == 'examples/j_external_pcint_library/'
- name: Build PlatformIO examples
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}
PLATFORMIO_BUILD_FLAGS: -DSDI12_EXTERNAL_PCINT
run: |
echo "${{ env.LIBRARY_INSTALL_SOURCE }}"
pio lib --global install ${{ env.LIBRARY_INSTALL_SOURCE }}
pio lib --global install EnableInterrupt
platformio ci --board=mayfly --board=feather32u4 --board=adafruit_feather_m0 --board=uno --board=megaatmega2560
pio lib --global uninstall SDI-12
PLATFORMIO_BUILD_FLAGS: -D SDI12_EXTERNAL_PCINT
PLATFORMIO_CI_SRC: examples/j_external_pcint_library
run: pio ci --board=mayfly --board=uno --board=megaatmega2560 --board=leonardo --board=zeroUSB --board=feather328p --board=feather32u4 --board=adafruit_feather_m0 --lib="." --project-option="lib_deps=greygnome/EnableInterrupt@^1.1.0"
4 changes: 2 additions & 2 deletions .github/workflows/changelog_reminder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Changelog Reminder
uses: peterjgrainger/action-changelog-reminder@v1.3.0
with:
changelog_regex: '/ChangeLog\/.*\/*.md'
changelog_regex: '/CHANGELOG\/.*\/*.md/i'
customPrMessage: 'Please add your changes to the change log!'
env:
GITHUB_TOKEN: ${{ secrets.SARA_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87 changes: 31 additions & 56 deletions .github/workflows/prepare_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,43 @@ on:
- 'VERSION' # Push events when the VERSION file changes
workflow_dispatch:

name: Prepare a new release
name: Create a New Release

env:
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}

jobs:
release:
name: Prepare a new release
wait_for_checks:
if: ${{ github.event_name != 'workflow_dispatch' }}
strategy:
matrix:
req_workflow:
[
verify_library_structure.yaml,
build_examples.yaml,
build_documentation.yaml,
]
name: Wait for Checks to complete
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set variables
run: |
echo "::debug::Get the current version number"
VER=$(cat VERSION)
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Restore or Cache pip
uses: actions/cache@v4.0.2
with:
path: ~/.cache/pip
# if requirements.txt hasn't changed, then it will be a "cache hit" and pip will be restored
# if requirements.txt HAS changed, it will be a "cache miss" and a new cache of pip will be created if the job completes successfully
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Set up Python
uses: actions/setup-python@v5
- name: Wait on Workflow
uses: ArcticLampyrid/action-wait-for-workflow@v1.2.0
with:
python-version: '3.x'
workflow: ${{ matrix.req_workflow }}
sha: ${{ github.sha || github.event.pull_request.head.sha || github.event.pull_request.head.ref }} # optional
allowed-conclusions: |
success
cancelled
skipped
# This should be pulled from cache, if there's not a new version
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Get notes
id: generate_notes
uses: anmarkoulis/commitizen-changelog-reader@master
with:
# NOTE: Need to add the refs/tags to work with the generate notes action
tag_name: ${{ format('refs/tags/{0}', env.VERSION) }}
changelog: ChangeLog.md

# Create a new release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: false
prerelease: false
body: ${{join(fromJson(steps.generate_notes.outputs.notes).notes, '')}}

# Publish the new release to the pio package manager
- name: Publish release to PIO
id: publish-pio
run: pio package publish
release:
name: Prepare a new release
needs: [wait_for_checks]
if: |
always() &&
(needs.wait_for_checks.result == 'success' || needs.wait_for_checks.result == 'skipped')
uses: EnviroDIY/workflows/.github/workflows/prepare_release.yaml@main
secrets: inherit
with:
library-manager: 'update'
library-compliance: 'strict'
Loading

0 comments on commit a4d6115

Please sign in to comment.