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

Add Github Actions Windows-based CI runner #458

Merged
merged 4 commits into from
Sep 14, 2020
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
49 changes: 49 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run tests on MacOS

on: [pull_request]

jobs:
macos_testing:
runs-on: macos-10.15

steps:
- name: Setup environment - Brew tap
run: |
brew tap osx-cross/avr
brew tap osx-cross/arm

- name: Setup environment - Brew install
run: |
brew install git doxygen boost gcc avr-gcc arm-gcc-bin cmake || true
brew upgrade boost gcc git || true

- name: Setup environment - Python pip
run: |
pip3 install --user modm scons
echo "::add-path::/usr/local/bin"
echo "::add-path::/Users/runner/Library/Python/3.8/bin"
echo $PATH

- name: Check out repository
uses: actions/checkout@v2

- name: Git Submodules
run: |
git submodule update --init

- name: Hosted Unittests
run: |
(cd test && make run-hosted-darwin)

- name: Hosted Examples
run: |
(cd examples && ../tools/scripts/examples_compile.py linux)

- name: Compile STM32 Examples
run: |
(cd examples && ../tools/scripts/examples_compile.py nucleo_f031k6 nucleo_f103rb nucleo_f303re nucleo_f411re nucleo_f746zg)
(cd examples && ../tools/scripts/examples_compile.py nucleo_g071rb nucleo_l152re nucleo_l476rg nucleo_g474re)

- name: Compile AVR Examples
run: |
(cd examples && ../tools/scripts/examples_compile.py avr)
63 changes: 63 additions & 0 deletions .github/workflows/windows_armcortexm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Run ARM Cortex-M tests on Windows

on: [pull_request]

jobs:
windows_armcortexm:
runs-on: windows-2019
#env:
# PYTHONIOENCODING: "utf-8"

steps:

# Disabling snake-oil for performance reasons
- name: Disable Windows Defender
run: Set-MpPreference -DisableRealtimeMonitoring $true

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Install Python packages
run: |
pip install --user modm scons future

- name: Download ARM Toolchain
shell: powershell
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile gcc-arm-none-eabi-win32.zip https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-win32.zip

- name: Install ARM Toolchain
shell: powershell
run: |
Add-Type -Assembly "System.IO.Compression.Filesystem"
[System.IO.Compression.ZipFile]::ExtractToDirectory("gcc-arm-none-eabi-win32.zip", "C:\arm-none-eabi-gcc")
dir C:\arm-none-eabi-gcc
echo "::add-path::C:\arm-none-eabi-gcc\bin"
rm gcc-arm-none-eabi-win32.zip

- name: Show lbuild and arm-none-eabi-gcc Version Information
run: |
lbuild --version
arm-none-eabi-g++ --version

- name: Check out repository
uses: actions/checkout@v2

- name: Git Submodules
shell: bash
run: |
git submodule update --init

- name: Compile STM32 Examples
shell: bash
run: |
(cd examples && python ../tools/scripts/examples_compile.py nucleo_f031k6 nucleo_f103rb nucleo_f303re nucleo_f411re nucleo_f746zg)
(cd examples && python ../tools/scripts/examples_compile.py nucleo_g071rb nucleo_l152re nucleo_l476rg nucleo_g474re)

# - name: Compile AVR Examples
# shell: bash
# run: |
# (cd examples && python ../tools/scripts/examples_compile.py avr)
68 changes: 68 additions & 0 deletions .github/workflows/windows_hosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Run hosted tests on Windows

on: [pull_request]

jobs:
windows_hosted:
runs-on: windows-2019
#env:
# PYTHONIOENCODING: "utf-8"

steps:

# Disabling snake-oil for performance reasons
- name: Disable Windows Defender
run: Set-MpPreference -DisableRealtimeMonitoring $true

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Install Python packages
run: |
pip install --user modm scons future

- name: Download MinGW installer
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile mingw-get-0.6.3.zip https://acc.dl.osdn.jp/mingw/68260/mingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip

- name: Unpack MinGW installer
shell: powershell
run: |
Add-Type -Assembly "System.IO.Compression.Filesystem"
[System.IO.Compression.ZipFile]::ExtractToDirectory("mingw-get-0.6.3.zip", "C:\mingw-get")
dir C:\mingw-get
echo "::add-path::C:\mingw-get\bin"
rm mingw-get-0.6.3.zip

- name: Install MinGW toolchains
shell: powershell
run: |
mingw-get install gcc g++ mingw32-make

- name: Show lbuild and gcc version
run: |
lbuild --version
gcc --version
g++ --version
make --version

- name: Check out repository
uses: actions/checkout@v2

- name: Git Submodules
shell: bash
run: |
git submodule update --init

- name: Hosted Examples
shell: bash
run: |
(cd examples && python ../tools/scripts/examples_compile.py linux/assert linux/block_device linux/build_info linux/git linux/logger linux/printf)

- name: Hosted Unittests
shell: bash
run: |
(cd test && make run-hosted-windows)
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/linux/assert/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run fail -->
Copy link
Member

Choose a reason for hiding this comment

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

This is a hint to the examples_compile.py script that the example should be run and that a failure is expected.

<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../build/linux/assert</option>
Expand All @@ -8,6 +9,5 @@
<module>modm:architecture:assert</module>
<module>modm:debug</module>
<module>modm:build:scons</module>
<module>modm:build:cmake</module>
</modules>
</library>
1 change: 1 addition & 0 deletions examples/linux/block_device/file/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../../build/linux/block_device/file</option>
Expand Down
1 change: 1 addition & 0 deletions examples/linux/block_device/mirror/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../../build/linux/block_device/mirror</option>
Expand Down
1 change: 1 addition & 0 deletions examples/linux/block_device/ram/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../../build/linux/block_device/ram</option>
Expand Down
1 change: 1 addition & 0 deletions examples/linux/build_info/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../build/linux/build_info</option>
Expand Down
1 change: 1 addition & 0 deletions examples/linux/git/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../build/linux/git</option>
Expand Down
1 change: 1 addition & 0 deletions examples/linux/logger/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../build/linux/logger</option>
Expand Down
1 change: 1 addition & 0 deletions examples/linux/printf/project.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<library>
<!-- CI: run -->
<options>
<option name="modm:target">hosted-linux</option>
<option name="modm:build:build.path">../../../build/linux/printf</option>
Expand Down
39 changes: 0 additions & 39 deletions examples/windows/build_info/main.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions examples/windows/build_info/project.xml

This file was deleted.

6 changes: 4 additions & 2 deletions ext/adamgreen/catcher.lb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ def build(env):
env.outbasepath = "modm/ext/crashcatcher"

env.copy("crashcatcher/CrashCatcher/include/CrashCatcher.h", "include/CrashCatcher.h")
ignore = "*armv7m.S" if "m0" in core else "*armv6m.S"
env.copy("crashcatcher/CrashCatcher/Core/src", "src", ignore=env.ignore_files(ignore))
env.copy("crashcatcher/CrashCatcher/Core/src", "src", ignore=env.ignore_files("*.S"))
version = "armv{}m".format("6" if "m0" in core else "7")
env.copy("crashcatcher/CrashCatcher/Core/src/CrashCatcher_{}.S".format(version),
"src/CrashCatcher_{}.sx".format(version))
Copy link
Member

Choose a reason for hiding this comment

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

I should open an issue for this in the original repo.

2 changes: 1 addition & 1 deletion ext/dlr/scons-build-tools
5 changes: 5 additions & 0 deletions repo.lb
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,15 @@ def init(repo):
path = normpath(path)
escaped = "\\" * (2 ** escape_level)
return path.replace("\\", escaped)
def posixify(path):
return normpath(path).replace("\\", "/")
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this is a dumb solution, and that lbuild should have some option to reformat paths somehow, but it's all such a horrible mess, I don't want to deal with it.

else:
def windowsify(path, escape_level):
return normpath(path)
def posixify(path):
return normpath(path)
repo.add_filter("modm.windowsify", windowsify)
repo.add_filter("modm.posixify", posixify)
repo.add_filter("modm.ord", lambda letter: ord(letter[0].lower()) - ord("a"))
repo.add_filter("modm.chr", lambda num: chr(num + ord("A")))

Expand Down
2 changes: 1 addition & 1 deletion src/modm/architecture/interface.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stdint.h>

%% for header in headers
#include "{{header}}"
#include "{{ header | modm.posixify }}"
%% endfor
#include "interface/peripheral.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/modm/architecture/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def prepare(module, options):
def build(env):
env.outbasepath = "modm/src/modm/architecture"

headers = env.generated_local_files(filterfunc=lambda path: re.match(r"interface/.*\.hpp", path))
headers = env.generated_local_files(filterfunc=lambda path: re.match(r"interface[\\/]\w+\.hpp", path))
env.template("interface.hpp.in", substitutions={"headers": sorted(headers)})

env.copy("utils.hpp")
Expand Down
5 changes: 1 addition & 4 deletions src/modm/debug/logger/level.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#ifndef MODM_LOG_LEVEL_HPP
#define MODM_LOG_LEVEL_HPP

#pragma push_macro("ERROR") // avoid collision with ERROR defined macro in winsock.h
#undef ERROR
#undef ERROR // avoid collision with ERROR defined macro in winsock.h
Copy link
Member

Choose a reason for hiding this comment

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

push/pop wasn't enough, not sure how to solve this properly.


namespace modm
{
Expand Down Expand Up @@ -59,6 +58,4 @@ namespace modm
#define MODM_LOG_LEVEL modm::log::DEBUG
#endif // MODM_LOG_LEVEL

#pragma pop_macro("ERROR")

#endif // MODM_LOG_LEVEL_HPP
2 changes: 1 addition & 1 deletion src/modm/io/iostream.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public:
inline IOStream& operator << (const uint64_t& v)
{ writeIntegerMode(v); return *this; }

%% if family in ["darwin"]
%% if family in ["darwin", "windows"]
// For OSX 'int64_t' is of type 'int'. Therefore there is no
// function here for the default type 'long int'. As 'long int' has the same
// width as 'int64_t' we just use a typedef here.
Expand Down
7 changes: 7 additions & 0 deletions src/modm/io/iostream_printf.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
*/
// ----------------------------------------------------------------------------

%% if family in ["windows"]
#define _vsnprintf _vsnprintf_windows
%% endif
#include <stdio.h>
%% if family in ["windows"]
#undef _vsnprintf
%% endif

#include <stdarg.h>
#include <modm/architecture/interface/accessor.hpp>
#include <cmath>
Expand Down
Loading