Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup extra comments and format files #163

Merged
merged 1 commit into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .arduino-ci.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
arduino-ci.yml export-ignore
/test/ export-ignore
.git* export-ignore
.travis.yml export-ignore
Gemfile export-ignore
57 changes: 4 additions & 53 deletions .github/workflows/CompileExamples.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,62 @@

# Description: 'Run the Arduino CLI to compile example sketches and check if they compile correctly for multiple boards'
# Author: 'Jorge Rivera' #url: 'https://github.com/latchdevel'

# This is the name of the workflow, visible on GitHub UI.
name: Compile examples

# Controls when the action will run.
# Here we tell GitHub to run the workflow when a commit.
on:
# Triggers the workflow on push or pull request events
push:
paths:
- "src/**"
- "examples/**"
- ".github/workflows/CompileExamples.yml"

pull_request:
paths:
- "src/**"
- "examples/**"
- ".github/workflows/CompileExamples.yml"

# Scheduled the first day of every month at 00:00h UTC
schedule:
- cron: '0 0 1 * *'
- cron: "0 0 1 * *"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
repository_dispatch:

# This is the list of jobs that will be run concurrently.
# Since we use a build matrix, the actual number of jobs
# started depends on how many configurations the matrix
# will produce.
jobs:
boards:
# This is the name of the job
name: "Compile for ${{ matrix.config.board }}"

# This is the platform GitHub will use to run our workflow
runs-on: ubuntu-latest

# Here we tell GitHub that the jobs must be determined
# dynamically depending on a matrix configuration.
strategy:

# Set to false so that GitHub does not cancel all jobs
# in progress if any array job fails.
fail-fast: false

# The matrix will produce one job for each configuration:
matrix:
config:
- board: "Arduino Uno"
fqbn: "arduino:avr:uno"
platform: "arduino:avr"

- board: "Arduino Leonardo"
fqbn: "arduino:avr:leonardo"
platform: "arduino:avr"

- board: "Arduino Mega2560"
fqbn: "arduino:avr:mega"
platform: "arduino:avr"

- board: "Arduino Due"
fqbn: "arduino:sam:arduino_due_x"
platform: "arduino:sam"

- board: "ESP32 NodeMCU-32S"
fqbn: "esp32:esp32:nodemcu-32s"
platform: "esp32:esp32"
additional-url: "--additional-urls https://dl.espressif.com/dl/package_esp32_index.json"

# This is the list of steps this job will run.
steps:
# We use the "arduino/setup-arduino-cli" action to install and
# configure the Arduino CLI on the system.
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v2

# We then install the platform, which one will be determined
# dynamically by the build matrix.
- name: Install platform ${{ matrix.config.platform }}
- name: Install platform ${{ matrix.config.platform }}
run: |
arduino-cli config init -v ${{ matrix.config.additional-url }}
arduino-cli core update-index -v
arduino-cli core install -v ${{ matrix.config.platform }} --run-post-install

# Install generic libraries from Arduino library manager.
- name: Install Arduino libraries
run: |
arduino-cli lib update-index
arduino-cli lib install Ethernet
arduino-cli lib install LoRa

# First of all, we clone the repo using the "checkout" action.
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v4

# Finally, we compile the sketches, using the FQBN that was set in the boards matrix.
- name: Compile examples for ${{ matrix.config.board }}
id: compile
env:
env:
fqbn: ${{ matrix.config.fqbn }}
run: |
# Compile example sketches:
Expand All @@ -121,11 +74,9 @@ jobs:
;}
done
echo "errors=${errors[@]}" >> $GITHUB_OUTPUT

# Show errors
- name: Show errors
if: ${{ steps.compile.outputs.errors }}
env:
env:
errors: ${{ steps.compile.outputs.errors }}
run: |
# Show errors
Expand Down
57 changes: 8 additions & 49 deletions .github/workflows/NativeUnitTests.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,45 @@
# Run aWOT Unit Tests natively on MacOS and Linux systems.

# This is the name of the workflow, visible on GitHub UI.
name: Unit Tests

# Controls when the action will run.
# Here we tell GitHub to run the workflow when a commit.
on:
# Triggers the workflow on push or pull request events
push:
paths:
- "src/**"
- "test/**"
- ".github/workflows/NativeUnitTests.yml"

pull_request:
paths:
- "src/**"
- "test/**"
- ".github/workflows/NativeUnitTests.yml"

# Scheduled the first day of every month at 00:00h UTC
schedule:
- cron: '0 0 1 * *'

# Allows you to run this workflow manually from the Actions tab
- cron: "0 0 1 * *"
workflow_dispatch:
repository_dispatch:

# This is the list of jobs that will be run concurrently.
# Since we use a build matrix, the actual number of jobs
# started depends on how many configurations the matrix
# will produce.
jobs:
build:
# This is the name of the job
name: 'Build for ${{ matrix.config.name }}'

# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows, Linux or Mac.
name: "Build for ${{ matrix.config.name }}"
runs-on: ${{ matrix.config.os }}

# Job env var for cmake build directory
env:
BUILD_DIR: ${{ github.workspace }}/test/build

# Here we tell GitHub that the jobs must be determined
# dynamically depending on a matrix configuration.
strategy:

# Set to false so that GitHub does not cancel all jobs
# in progress if any array job fails.
fail-fast: false

# The matrix will produce one job for each configuration:
matrix:
config:
- name: 'Linux x86_64'
os: 'ubuntu-latest'

- name: 'macOS Universal'
os: 'macos-latest'

# This is the list of steps this job will run.
- name: "Linux x86_64"
os: "ubuntu-latest"
- name: "macOS Universal"
os: "macos-latest"
steps:
# Clone repo using the checkout action.
- name: Checkout
uses: actions/checkout@v4

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{ env.BUILD_DIR }}

- name: Running CMake
- name: Running CMake
working-directory: ${{ env.BUILD_DIR }}
run: cmake ..

- name: Build Unit Tests
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build .

- name: Run Unit Tests
if: ${{ success() }}
working-directory: ${{ env.BUILD_DIR }}
run: ctest
run: ctest
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions Gemfile

This file was deleted.

33 changes: 0 additions & 33 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,98 +1,65 @@
#
# CMake file to build and run aWOT Unit Tests natively on MacOS or Linux systems.
#
# Arduino Unit Tests from https://github.com/Arduino-CI/arduino_ci Apache-2.0 license
# EpoxyDuino Core from https://github.com/bxparks/EpoxyDuino MIT License
#
# MIT License

cmake_minimum_required( VERSION 3.18 )

project( aWOT-test LANGUAGES CXX )

# Set C++ standard
set( CMAKE_CXX_STANDARD 11 )
set( CMAKE_CXX_STANDARD_REQUIRED TRUE )

# Set compiler identification
if( NOT BUILD_COMPILER )
set( BUILD_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
message( STATUS "C++ compiler: " ${BUILD_COMPILER} )
endif()

# If macOS builds a Mach-O universal binary with 2 architectures: x86_64 and arm64 for Apple M processors
if ( APPLE )
set( CMAKE_OSX_ARCHITECTURES "x86_64;arm64" )
endif()

# Set build type to "Debug"
set( CMAKE_BUILD_TYPE "Debug" )

# Ensures all binaries are placed in the same output directory
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )

# Setting build type to "debug" add only -g
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG" )

# Set C++ compiler flags
if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-gnu-zero-variadic-macro-arguments" )
elseif ( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4" )
endif()

# Enable testing
enable_testing()

# Add EpoxyDuino Core source files
aux_source_directory( epoxy EPOXY )

# Compile EpoxyDuino Core as an object library
add_library( ${PROJECT_NAME}-EpoxyDuino OBJECT ${EPOXY} )

# Add include directory to use #include <file.h> or "file.h"
target_include_directories( ${PROJECT_NAME}-EpoxyDuino PUBLIC epoxy )

# Defines EPOXY_CORE_ESP8266 macro for EpoxyDuino Core
target_compile_definitions( ${PROJECT_NAME}-EpoxyDuino PRIVATE EPOXY_CORE_ESP8266 )

# Add Arduino Unit Test source files
aux_source_directory( unittest UNITTEST )

# Compile Arduino Unit Test as an object library
add_library( ${PROJECT_NAME}-unittest OBJECT ${UNITTEST} )

# Add include directory to use #include <file.h> or "file.h"
target_include_directories( ${PROJECT_NAME}-unittest PUBLIC epoxy )

# Add aWOT source files
aux_source_directory( ../src aWOT )

# Compile aWOT as an object library
add_library( ${PROJECT_NAME}-aWOT OBJECT ${aWOT} )

# Add include directory to use #include <file.h> or "file.h"
target_include_directories( ${PROJECT_NAME}-aWOT PUBLIC epoxy unittest )

# List of test source files
file( GLOB TEST_SOURCES *.cpp )

foreach( TEST_FILE ${TEST_SOURCES} )

# Get test name
get_filename_component( TEST_NAME ${TEST_FILE} NAME_WE )

# Compile test target
add_executable( ${PROJECT_NAME}-${TEST_NAME} ${TEST_FILE} )
target_link_libraries( ${PROJECT_NAME}-${TEST_NAME} PRIVATE ${PROJECT_NAME}-aWOT ${PROJECT_NAME}-EpoxyDuino ${PROJECT_NAME}-unittest )

# Add test
add_test( NAME ${TEST_NAME} COMMAND $<TARGET_FILE:${PROJECT_NAME}-${TEST_NAME}> )

# Add test to dependency list
list( APPEND TEST_LIST ${PROJECT_NAME}-${TEST_NAME} )

endforeach()

# Add optional target to run tests
add_custom_target( run_tests COMMAND ${CMAKE_CTEST_COMMAND} --verbose DEPENDS ${TEST_LIST} )
Loading
Loading