Skip to content

Commit

Permalink
Merge 9e50d37 into fd0bbfb
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Jul 9, 2022
2 parents fd0bbfb + 9e50d37 commit d00bd08
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Expand Up @@ -102,6 +102,11 @@ indent_style = tab
[Dockerfile]
indent_size = 2

# Docker

[Earthfile]
indent_size = 2

# Dagger
[*.cue]
indent_style = space
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -323,6 +323,31 @@ jobs:
report_paths: test/*.xml
if: always()

#===================================================================
earthly:
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: earthly/actions-setup@v1
with:
version: "latest"
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
run: earthly --ci +build
- name: Test
run: earthly --ci +test
- run: ls earthly-out/TestResults
- name: Report
uses: ./.github/actions/composite/test-report
with:
report_paths: earthly-out/TestResults/*.xml
if: always()

#===================================================================
dagger:
runs-on: ubuntu-latest
Expand All @@ -335,6 +360,12 @@ jobs:
project init
project update
do ctest
- run: ls dagger-out/TestResults
- name: Report
uses: ./.github/actions/composite/test-report
with:
report_paths: dagger-out/TestResults/*.xml
if: always()

#===================================================================
infer:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -99,6 +99,9 @@ cmake-build*/
# Infer
infer-out/

# Earthly
earthly-out/

# Dagger
cue.mod/
dagger-out/
Expand Down
56 changes: 56 additions & 0 deletions Earthfile
@@ -0,0 +1,56 @@
# earthly version
VERSION 0.6

# Earthfile
FROM ubuntu:22.04

# configure apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

# install dependencies
RUN apt-get update && apt-get install -y \
build-essential cmake \
git \
python3 python-is-python3

# iutest test env
ENV IUTEST_OUTPUT_DIR=TestResults

WORKDIR /code

all:
BUILD +lint
BUILD +build
BUILD +test

full:
BUILD +all
BUILD +cppcheck

code:
COPY . src

build:
FROM +code
RUN mkdir -p ${IUTEST_OUTPUT_DIR}
RUN cmake src/projects/cmake -DTEST_OUTPUT_DIR=${IUTEST_OUTPUT_DIR}
# cache cmake temp files to prevent rebuilding .o files
# when the .cpp files don't change
RUN --mount=type=cache,target=/code/CMakeFiles make

test:
FROM +build
RUN --mount=type=cache,target=/code/CMakeFiles ctest .
SAVE ARTIFACT ${IUTEST_OUTPUT_DIR} AS LOCAL earthly-out/

lint:
FROM +code
RUN make -C src/test/cpplint

cppcheck:
FROM +code
RUN apt-get update && apt-get install -y cppcheck
RUN make -C src/test/cppcheck
RUN make -C src/test/cppcheck html HTML_REPORT_DIR=./cppcheck-result
SAVE ARTIFACT src/test/cppcheck/cppcheck-result AS LOCAL earthly-out/
2 changes: 1 addition & 1 deletion iutest.cue
Expand Up @@ -102,7 +102,7 @@ dagger.#Plan & {

input: cmake.output
script: contents: """
cmake --build .
cmake --build . -j 4
"""
}

Expand Down
1 change: 1 addition & 0 deletions projects/vscode/iutest.code-workspace
Expand Up @@ -14,6 +14,7 @@
"*.ipp": "cpp",
"*.inl": "cpp",
"*.in": "makefile",
"Earthfile": "dockerfile",
".ecrc": "json",
".nuspec": "xml",
".targets": "xml",
Expand Down
5 changes: 3 additions & 2 deletions test/cppcheck/Makefile
Expand Up @@ -4,7 +4,8 @@


# iutest root directory
IUTEST_DIR = ../..
MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
IUTEST_DIR = $(MAKEFILE_DIR)/../..
IUTEST_INCLUDE = -I$(IUTEST_DIR)/include

IUTEST_HEADERS =$(IUTEST_DIR)/include/*.hpp \
Expand All @@ -19,7 +20,7 @@ IUTEST_HEADERS =$(IUTEST_DIR)/include/*.hpp \
# cppcheck configuration
#

include Config.mk
include $(MAKEFILE_DIR)/Config.mk

CPPCHECK_DEFINES_OPTIONS=$(patsubst %,-D%,$(CPPCHECK_DEFINES))
CPPCHECK_UNDEFINES_OPTIONS=$(patsubst %,-U%,$(CPPCHECK_UNDEFINES))
Expand Down
7 changes: 6 additions & 1 deletion test/cpplint/Makefile
@@ -1,5 +1,9 @@
#
# Makefile
#
# Copyright (C) 2022, Takazumi Shirayanagi
# This software is released under the new BSD License,
# see LICENSE

.PHONY: default clean all iutest internal util listener impl gtest src samples test

Expand All @@ -14,6 +18,7 @@ GTEST_HPP=$(wildcard ../../include/gtest/*.hpp) $(wildcard ../../include/gtest/s
SRC_CPP=$(wildcard ../../src/*.cpp)
SAMPLES=$(wildcard ../../samples/*.cpp)
TESTS=$(wildcard ../../test/*.cpp) $(wildcard ../../test/*.hpp)
EXCLUDE_NS_TESTS=$(subst ns.cpp,.cpp,$(TESTS))

SUPPRESS_WHITESPACE_SUB=/indent,/braces,/comments,/newline,/labels,/operators,/parens
SUPPRESS_WHITESPACE=$(subst /,-whitespace/,$(SUPPRESS_WHITESPACE_SUB))
Expand Down Expand Up @@ -51,7 +56,7 @@ samples: $(SAMPLES) cpplint.py Makefile
$(PYTHON) cpplint.py --extensions=hpp,cpp --linelength=120 --filter=$(SUPPRESS),-build/namespace,-runtime/printf $(SAMPLES)

test: $(SRC_CPP) cpplint.py Makefile
$(PYTHON) cpplint.py --extensions=hpp,cpp --linelength=150 --filter=$(SUPPRESS),-build/namespace,-build/include $(TESTS)
$(PYTHON) cpplint.py --extensions=hpp,cpp --linelength=150 --filter=$(SUPPRESS),-build/namespace,-build/include $(EXCLUDE_NS_TESTS)

sider:
cd ../../ && \
Expand Down

0 comments on commit d00bd08

Please sign in to comment.