Skip to content

Commit

Permalink
Merge pull request #188 from abeimler/feature/cross-arm
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Jan 19, 2023
2 parents 25196f0 + 08b5cb6 commit 655154d
Show file tree
Hide file tree
Showing 40 changed files with 968 additions and 42 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/ci.cross.arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: ci-cross-arm
on:
pull_request:
push:
branches:
- main
- master

jobs:
Test:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
cmake:
- true
task:
- rpi4:build.cross
- rpi4-vcpkg:build.cross
- rpi4:build.cross.custom-toolchain
- rpi3:build.cross
include:
- task: rpi4:build.cross
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi4-vcpkg:build.cross
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi4:build.cross.custom-toolchain
install-cross-compiler: g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
target: aarch64-linux-gnu
- task: rpi3:build.cross
install-cross-compiler: gcc-arm-none-eabi binutils-arm-none-eabi
target: arm-none-eabi
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/vcpkg
./build/vcpkg_installed
${{ env.HOME }}/.cache/vcpkg/archives
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-cross-${{ matrix.target }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}-${{ matrix.cmake }}
restore-keys: |
${{ runner.os }}-${{ env.BUILD_TYPE }}-
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
cmake: ${{ matrix.cmake }}
ninja: true
vcpkg: true
conan: true
cppcheck: true
clangtidy: true
task: true
doxygen: true
powershell: true

- name: Setup ARM (Cross) Compiler
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: ${{ matrix.install-cross-compiler }}
version: 1.0

- name: Build (Task)
run: |
task ${{ matrix.task }}
env:
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
cmake:
- true
platform:
Expand All @@ -41,7 +41,7 @@ jobs:
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-mingw-${{ matrix.platform }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}-${{ matrix.cmake }}
key: ${{ runner.os }}-cross-mingw-${{ matrix.platform }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}-${{ matrix.cmake }}
restore-keys: |
${{ runner.os }}-${{ env.BUILD_TYPE }}-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
cmake:
- true
steps:
Expand Down
10 changes: 10 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ includes:
emscripten:
taskfile: ./tests/emscripten/Taskfile.yml
dir: ./tests/emscripten
rpi3:
taskfile: ./tests/rpi3/Taskfile.yml
dir: ./tests/rpi3
rpi4:
taskfile: ./tests/rpi4/Taskfile.yml
dir: ./tests/rpi4
rpi4-vcpkg:
taskfile: ./tests/rpi4-vcpkg/Taskfile.yml
dir: ./tests/rpi4-vcpkg

vars:
CWD:
Expand Down Expand Up @@ -53,6 +62,7 @@ tasks:
- install:lint
- minimal:lint
- emscripten:lint
- rpi4-vcpkg:lint

clean:
- cmd: powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./install'
Expand Down
14 changes: 13 additions & 1 deletion cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ words:
- anotherproj
- applellvm
- ARGN
- armv
- asan
- buildtools
- ccache
Expand All @@ -29,10 +30,10 @@ words:
- CPATH
- Cppcheck
- cppcoreguidelines
- cppreference
- cppdbg
- CPPFLAGS
- cpprc
- cppreference
- ctest
- Cuda
- DCMAKE
Expand All @@ -41,6 +42,7 @@ words:
- DOPT
- dyld
- dylib
- eabi
- egor-tensin
- Eigen
- emcc
Expand All @@ -52,20 +54,29 @@ words:
- fdiagnostics
- ftime
- gcovr
- gnueabi
- gnueabihf
- Graphviz
- hwrap
- iwwu
- kcov
- LDFLAGS
- lgcc
- libc
- libcuda
- libg
- libstdc
- LPSTR
- LPWSTR
- lrdimon
- lstdc
- mcpu
- mdfile
- mfpu
- msbuild
- msvc
- msys
- mthumb
- multilib
- municode
- myapp
Expand All @@ -89,6 +100,7 @@ words:
- shlib
- suppr
- SYSROOT
- tecolicom
- TOLOWER
- TOUPPER
- ubsan
Expand Down
37 changes: 36 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,39 @@ services:
target: build-minimal
environment:
- CROSS_CC=i686-w64-mingw32-gcc
- CROSS_CXX=i686-w64-mingw32-g++
- CROSS_CXX=i686-w64-mingw32-g++
build-rpi3:
build:
context: .
dockerfile: ./docker/Dockerfile.arm
target: build
build-rpi3-debug:
build:
context: .
dockerfile: ./docker/Dockerfile.arm
target: build-debug
build-rpi4:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build
build-rpi4-debug:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-debug
test-rpi4:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: test
build-rpi4-vcpkg:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-vcpkg
build-rpi4-custom:
build:
context: .
dockerfile: ./docker/Dockerfile.aarch64
target: build-custom
2 changes: 2 additions & 0 deletions docker/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.sh text eol=lf
15 changes: 8 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
FROM ubuntu:22.04 AS base

ARG setup_cpp_linux_version="0.24.1"

# add setup_cpp https://github.com/aminya/setup-cpp
ADD https://github.com/aminya/setup-cpp/releases/download/v${setup_cpp_linux_version}/setup_cpp_linux /setup_cpp_linux
RUN chmod +x /setup_cpp_linux

# add setup-cpp https://github.com/aminya/setup-cpp
RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g setup-cpp

FROM base AS setup

ARG compiler="gcc"
# install cmake, ninja, and ccache
RUN /setup_cpp_linux --compiler $compiler --llvm true --cmake true --doxygen true --ninja true --ccache true --cppcheck true --vcpkg true --conan true --task true
RUN setup-cpp --compiler $compiler --llvm true --cmake true --doxygen true --ninja true --ccache true --cppcheck true --vcpkg true --conan true --task true


COPY ./docker/entrypoint.sh /docker-entrypoint.sh
Expand All @@ -21,11 +20,13 @@ ENTRYPOINT [ "/docker-entrypoint.sh" ]
FROM setup AS build
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task myproj:build"]


FROM setup AS test
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task myproj:test"]

57 changes: 57 additions & 0 deletions docker/Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM ubuntu:22.04 AS base

# add setup-cpp https://github.com/aminya/setup-cpp
RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g setup-cpp



FROM base AS setup

# install cmake, ninja, and ccache
RUN setup-cpp --clangtidy true --clangformat true --cmake true --ninja true --ccache true --cppcheck true --vcpkg true --conan true --task true

RUN apt-get update && apt-get install -y \
g++-aarch64-linux-gnu gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu \
&& rm -rf /var/lib/apt/lists/*

COPY ./docker/entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]


FROM setup AS build
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4:build.cross"]

FROM setup AS build-debug
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4:build.cross.debug"]

FROM setup AS build-vcpkg
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4-vcpkg:build.cross"]

FROM setup AS build-custom
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi4:build.cross.custom-toolchain"]


FROM setup AS test
RUN apt-get update && apt-get install -y \
qemu-user \
&& rm -rf /var/lib/apt/lists/*
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
ENV QEMU_LD_PREFIX /usr/aarch64-linux-gnu
CMD ["/bin/bash", "-c", "task rpi4:build.cross && qemu-aarch64 /home/project_options/tests/rpi4/build/Release/example"]
35 changes: 35 additions & 0 deletions docker/Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:22.04 AS base

# add setup-cpp https://github.com/aminya/setup-cpp
RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g setup-cpp



FROM base AS setup

# install cmake, ninja, and ccache
RUN setup-cpp --clangtidy true --clangformat true --cmake true --ninja true --ccache true --cppcheck true --vcpkg true --conan true --task true

RUN apt-get update && apt-get install -y \
gcc-arm-none-eabi binutils-arm-none-eabi \
&& rm -rf /var/lib/apt/lists/*

COPY ./docker/entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]


FROM setup AS build
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi3:build.cross"]


FROM setup AS build-debug
COPY . /home/project_options
WORKDIR /home/project_options
RUN git submodule update --init
CMD ["/bin/bash", "-c", "task rpi3:build.cross.debug"]
Loading

0 comments on commit 655154d

Please sign in to comment.