-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* GitHub Action: AVR build & unit test * Only run benchmark test on Release builds. * Switch to GitHub actions * Add manual run * Use workflow_call instead of workflow_run workflow_run will "only trigger a workflow run if the workflow file is on the default branch." * Use the ClangCL toolset on Windows+CLang * Lookup the C compiler & force build tests on * Simplify matrix, force tests on & clang fuzzing * Turn off clang fuzzers - compilation errors * Split Windows builds into separate jobs There is quite a big difference in the compiler toolchains. * Use marketplace cmake action * Windows: need to use MSVC command prompt So compilers are in the path. * Use MSVC compile options for clang-cl * Windows: specify generators * clang-cl: disable __umulh/__mulh intrinsics prior to VS2022 * Sanitize: use target_compile_options & target_link_options * Build on multiple ubuntu versions * Speed up canary build * Launch AVR build only on canary build success * Reinstate appveyor support * Update readme Build Status badge
- Loading branch information
1 parent
e4d0295
commit e72d827
Showing
14 changed files
with
425 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: AVR Build & Unit Tests | ||
|
||
on: | ||
# This job takes a long time to run, so only run it when the canary build passes | ||
# Ideally we'd use the workflow_run trigger and have GitHub launch this action, but the docs state: | ||
# This event will only trigger a workflow run if the workflow file is on the default branch. | ||
# ...which leads to some interesting behaviors | ||
workflow_call: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
AVRSimulator-Unit-Test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install PlatformIO | ||
working-directory: ./test/avr | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade platformio | ||
pip install wheel | ||
platformio upgrade | ||
platformio pkg update | ||
- name: Build All Environments | ||
shell: pwsh | ||
working-directory: ./test/avr | ||
run: Get-Content -Path .\platformio.ini | Where-Object { $_.StartsWith("[env:") } | ForEach-Object { & pio run -e $_.SubString(5, $_.Length-6) } | ||
|
||
- name: Run Simulator Unit Tests | ||
working-directory: ./test/avr | ||
run: platformio test -v -e megaatmega2560_sim_unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Canary Build and Test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
build_type: Release | ||
cpp_compiler: g++ | ||
output_folder: ${{github.workspace}}/build/ | ||
|
||
jobs: | ||
Canary-Build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure CMake & Build | ||
env: | ||
# Map from C++ compiler to equivalent C compiler | ||
g++: gcc | ||
clang++: clang | ||
uses: threeal/[email protected] | ||
with: | ||
build-dir: ${{ env.output_folder }} | ||
c-compiler: ${{ env[env.cpp_compiler] }} | ||
cxx-compiler: ${{ env.cpp_compiler }} | ||
build-args: -t tester | ||
options: | | ||
LIBDIVIDE_BUILD_TESTS=ON | ||
CMAKE_BUILD_TYPE=${{ env.build_type }} | ||
- name: Test | ||
working-directory: ${{env.output_folder}} | ||
run: ctest --build-config ${{env.build_type}} --verbose --tests-regex tester | ||
|
||
# Kick off the full build if everything above succeeded | ||
Full-Build: | ||
needs: Canary-Build | ||
uses: ./.github/workflows/full_build.yml | ||
|
||
# Kick off the full build if everything above succeeded | ||
AVR-Build: | ||
needs: Canary-Build | ||
uses: ./.github/workflows/avr_build_test.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: Full Build and Test | ||
|
||
on: | ||
# This job takes a long time to run, so only run it when the canary build passes | ||
# Ideally we'd use the workflow_run trigger and have GitHub launch this action, but the docs state: | ||
# This event will only trigger a workflow run if the workflow file is on the default branch. | ||
# ...which leads to some interesting behaviors | ||
workflow_call: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Full-Build-Ubuntu: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
# We want to test all matrix combinations regardless of failure | ||
fail-fast: false | ||
|
||
matrix: | ||
os: | ||
- ubuntu-24.04 | ||
- ubuntu-20.04 | ||
build_type: | ||
- Release | ||
- Sanitize | ||
cpp_compiler: | ||
- g++ | ||
- clang++ | ||
|
||
env: | ||
output_folder: ${{github.workspace}}/build/ | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure CMake & Build | ||
env: | ||
# Map from C++ compiler to equivalent C compiler | ||
g++: gcc | ||
clang++: clang | ||
uses: threeal/[email protected] | ||
with: | ||
build-dir: ${{ env.output_folder }} | ||
c-compiler: ${{ env[matrix.cpp_compiler] }} | ||
cxx-compiler: ${{ matrix.cpp_compiler }} | ||
options: | | ||
LIBDIVIDE_BUILD_TESTS=ON | ||
CMAKE_BUILD_TYPE=${{ matrix.build_type }} | ||
build-args: --config ${{ matrix.build_type }} | ||
|
||
- name: Test | ||
working-directory: ${{ env.output_folder }} | ||
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest --build-config ${{ matrix.build_type }} --verbose | ||
|
||
Full-Build-Windows: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
# We want to test all matrix combinations regardless of failure | ||
fail-fast: false | ||
# This makes development easier | ||
# max-parallel: 0 | ||
matrix: | ||
os: | ||
- windows-2022 | ||
- windows-2019 | ||
build_type: | ||
- Release | ||
- Sanitize | ||
cpp_compiler: | ||
- clang-cl.exe | ||
- cl.exe | ||
include: | ||
# Set generator per os | ||
# Note: These *expand* the existing matrix configurations, it doesn't create new matrix configurations | ||
# See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude | ||
- os: windows-2022 | ||
generator: Visual Studio 17 2022 | ||
- os: windows-2019 | ||
generator: Visual Studio 16 2019 | ||
# clang-cl requires the toolset flag be set correctly | ||
- cpp_compiler: clang-cl.exe | ||
toolset: ClangCL | ||
exclude: | ||
# MSVC Clang toolchain fails sanitization | ||
- cpp_compiler: clang-cl.exe | ||
build_type: Sanitize | ||
|
||
env: | ||
output_folder: ${{github.workspace}}/build/ | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Configure CMake & Build | ||
env: | ||
# Map from C++ compiler to equivalent C compiler | ||
cl.exe: cl.exe | ||
clang-cl.exe: clang-cl.exe | ||
toolset: ${{ matrix.toolset && format('-T {0}', matrix.toolset) || ''}} | ||
uses: threeal/[email protected] | ||
with: | ||
build-dir: ${{ env.output_folder }} | ||
c-compiler: ${{ env[matrix.cpp_compiler] }} | ||
cxx-compiler: ${{ matrix.cpp_compiler }} | ||
generator: ${{ matrix.generator }} | ||
args: ${{ env.toolset }} | ||
options: | | ||
LIBDIVIDE_BUILD_TESTS=ON | ||
CMAKE_BUILD_TYPE=${{ matrix.build_type }} | ||
build-args: --config ${{ matrix.build_type }} | ||
|
||
- name: Test | ||
working-directory: ${{ env.output_folder }} | ||
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest --build-config ${{ matrix.build_type }} --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.