Skip to content

Commit

Permalink
Añade soporte para Integración Continua
Browse files Browse the repository at this point in the history
  • Loading branch information
moshidev committed Jun 27, 2023
1 parent e6c2d8d commit 0535107
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 1 deletion.
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM daniel00/ceedling:latest
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "C++",
"build": { "dockerfile": "Dockerfile" },

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {},
"extensions": [
"ms-vscode.cpptools-extension-pack",
"numaru.vscode-ceedling-test-adapter",
"tomoki1207.pdf",
"eamodio.gitlens"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "make setup"

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
26 changes: 26 additions & 0 deletions .github/workflows/ceedling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ceedling CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Install Ceedling
run: gem install ceedling

- name: Run tests
run: ceedling
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
build
21 changes: 21 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "test",
"defines": [
"TEST"
],
"intelliSenseMode": "linux-gcc-x64",
"compilerPath": "/home/linuxbrew/.linuxbrew/bin/gcc",
"cStandard": "c99",
"cppStandard": "gnu++17",
"includePath": [
"${workspaceFolder}/src/**",
"${workspaceFolder}/build/test/mocks/**",
"${workspaceFolder}/test/support/**",
"/home/linuxbrew/.linuxbrew/lib/ruby/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src"
]
}
],
"version": 4
}
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"configurations": [
{
"name": "Ceedling Test Explorer Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"C_Cpp.autoAddFileAssociations": false,

"ceedlingExplorer.debugConfiguration": "Ceedling Test Explorer Debug",

"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.stickyTabStops": true,
"editor.indentSize": "tabSize",
"editor.detectIndentation": true,

"files.eol": "\n",
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
}
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# app-c-template
# [NOMBRE DEL PROYECTO]

Este repositorio contiene [DESCRIPCIÓN].

Corresponde a la capa de aplicación en la arquitectura sugerida en [project-guidelines](https://github.com/digicontrol-init9/project-guidelines).

## Pre-requisitos

Es necesario tanto [Docker](https://www.docker.com) como [Visual Studio Code](https://code.visualstudio.com), instalando el plugin `ms-vscode-remote.remote-containers`.

## Primeros pasos

Para trabajar sobre el repositorio pulsamos `F1` una vez dentro de Visual Studio Code y seleccionamos la opción `Dev Containers: Open Folder in Container`.
4 changes: 4 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
setup:
git config core.hooksPath .dev/hooks
git config --local core.autocrlf false
git config pull.ff only
102 changes: 102 additions & 0 deletions project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

:project:
:use_exceptions: FALSE
:use_test_preprocessor: TRUE
:use_auxiliary_dependencies: TRUE
:build_root: build
# :release_build: TRUE
:test_file_prefix: test_
:which_ceedling: gem
:ceedling_version: 0.31.1
:default_tasks:
- test:all

#:test_build:
# :use_assembly: TRUE

#:release_build:
# :output: MyApp.out
# :use_assembly: FALSE

:environment:

:extension:
:executable: .out

:paths:
:test:
- +:test/**
- -:test/support
:source:
- src/**
:support:
- test/support
:libraries: []

:defines:
# in order to add common defines:
# 1) remove the trailing [] from the :common: section
# 2) add entries to the :common: section (e.g. :test: has TEST defined)
:common: &common_defines []
:test:
- *common_defines
- TEST
:test_preprocess:
- *common_defines
- TEST

:cmock:
:mock_prefix: mock_
:when_no_prototypes: :warn
:enforce_strict_ordering: TRUE
:plugins:
- :ignore
- :callback
:treat_as:
uint8: HEX8
uint16: HEX16
uint32: UINT32
int8: INT8
bool: UINT8

# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
:gcov:
:reports:
- HtmlDetailed
:gcovr:
:html_medium_threshold: 75
:html_high_threshold: 90

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

# LIBRARIES
# These libraries are automatically injected into the build process. Those specified as
# common will be used in all types of builds. Otherwise, libraries can be injected in just
# tests or releases. These options are MERGED with the options in supplemental yaml files.
:libraries:
:placement: :end
:flag: "-l${1}"
:path_flag: "-L ${1}"
:system: [] # for example, you might list 'm' to grab the math library
:test: []
:release: []

:plugins:
:load_paths:
- "#{Ceedling.load_path}"
:enabled:
- stdout_pretty_tests_report
- module_generator
- xml_tests_report
...
5 changes: 5 additions & 0 deletions src/src/template.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* [YOUR NAME] © [THE YEAR]
*/

#include "template.h"
8 changes: 8 additions & 0 deletions src/template.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* [YOUR NAME] © [THE YEAR]
*/

#ifndef TEMPLATE_H
#define TEMPLATE_H

#endif // TEMPLATE_H
20 changes: 20 additions & 0 deletions test/test_template.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifdef TEST

#include "unity.h"

#include "template.h"

void setUp(void)
{
}

void tearDown(void)
{
}

void test_template_ToImplement(void) {
TEST_IGNORE_MESSAGE("I'm alive uwu.");
TEST_IGNORE_MESSAGE("Don't know where to start? Execute `ceedling help` in your terminal window.");
}

#endif // TEST

0 comments on commit 0535107

Please sign in to comment.