tutorial: added CI
This commit is contained in:
parent
2a9d1e6950
commit
a10e06a536
|
@ -0,0 +1,95 @@
|
||||||
|
|
||||||
|
name: ci
|
||||||
|
on:
|
||||||
|
# FIXME: if you want this to be available for PRs, uncomment this line
|
||||||
|
# pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
schedule:
|
||||||
|
- cron: '0 1 * * 0'
|
||||||
|
|
||||||
|
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
|
||||||
|
# just using caches instead of artifact upload.
|
||||||
|
jobs:
|
||||||
|
docker-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name: Create docker cache folder
|
||||||
|
run: mkdir -p /tmp/docker
|
||||||
|
-
|
||||||
|
name: Restore docker image
|
||||||
|
id: cache-docker
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /tmp/docker
|
||||||
|
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }}
|
||||||
|
-
|
||||||
|
name: Build docker builder-image
|
||||||
|
if: steps.cache-docker.outputs.cache-hit != 'true'
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: builder.Dockerfile
|
||||||
|
tags: cproject-builder:latest
|
||||||
|
outputs: type=docker,dest=/tmp/docker/${{ runner.os }}-builder-image.tar
|
||||||
|
|
||||||
|
build-and-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: docker-build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name: Restore docker image
|
||||||
|
id: cache-docker
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /tmp/docker
|
||||||
|
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }}
|
||||||
|
-
|
||||||
|
name: Load image
|
||||||
|
run: |
|
||||||
|
docker load --input /tmp/docker/${{ runner.os }}-builder-image.tar
|
||||||
|
docker image ls -a
|
||||||
|
-
|
||||||
|
name: Build library
|
||||||
|
run: |
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--workdir /builder/mnt \
|
||||||
|
-v ${{ github.workspace }}:/builder/mnt \
|
||||||
|
cproject-builder:latest \
|
||||||
|
/bin/bash -c "rm -rf build; cmake -B build; cmake --build build"
|
||||||
|
-
|
||||||
|
name: Test library
|
||||||
|
run: |
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--workdir /builder/mnt/test/unittest \
|
||||||
|
-v ${{ github.workspace }}:/builder/mnt \
|
||||||
|
cproject-builder:latest \
|
||||||
|
/bin/bash -c "ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
|
||||||
|
-
|
||||||
|
name: Archive coverage results
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
staging="reports-${{github.run_number}}"
|
||||||
|
mkdir -p "$staging"
|
||||||
|
cp -r test/unittest/build/artifacts/gcov "$staging"
|
||||||
|
tar czf "$staging.tar.gz" "$staging"
|
||||||
|
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
|
||||||
|
-
|
||||||
|
name: Archive artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: reports-${{github.run_number}}
|
||||||
|
path: ${{ env.ASSET }}
|
||||||
|
retention-days: 3
|
||||||
|
|
||||||
|
# TODO: delete cache on merge.
|
|
@ -80,13 +80,12 @@
|
||||||
* you are going to specify if you don't like the defaults.
|
* you are going to specify if you don't like the defaults.
|
||||||
**************************************************************************** */
|
**************************************************************************** */
|
||||||
|
|
||||||
/* Define this to be the number of bits an `int` takes up on your system. The
|
/* Define this to be the number of bits an `int` takes up on your system. The
|
||||||
* default, if not auto-detected, is 32 bits.
|
* default, if not auto-detected, is 32 bits.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*/
|
*/
|
||||||
/* #define UNITY_INT_WIDTH 16 */
|
/* #define UNITY_INT_WIDTH 16 */
|
||||||
#define UNITY_INT_WIDTH 32
|
|
||||||
|
|
||||||
/* Define this to be the number of bits a `long` takes up on your system. The
|
/* Define this to be the number of bits a `long` takes up on your system. The
|
||||||
* default, if not autodetected, is 32 bits. This is used to figure out what
|
* default, if not autodetected, is 32 bits. This is used to figure out what
|
||||||
|
@ -97,7 +96,6 @@
|
||||||
* Example:
|
* Example:
|
||||||
*/
|
*/
|
||||||
/* #define UNITY_LONG_WIDTH 16 */
|
/* #define UNITY_LONG_WIDTH 16 */
|
||||||
#define UNITY_LONG_WIDTH 32
|
|
||||||
|
|
||||||
/* Define this to be the number of bits a pointer takes up on your system. The
|
/* Define this to be the number of bits a pointer takes up on your system. The
|
||||||
* default, if not autodetected, is 32-bits. If you're getting ugly compiler
|
* default, if not autodetected, is 32-bits. If you're getting ugly compiler
|
||||||
|
@ -106,7 +104,6 @@
|
||||||
* Example:
|
* Example:
|
||||||
*/
|
*/
|
||||||
/* #define UNITY_POINTER_WIDTH 64 */
|
/* #define UNITY_POINTER_WIDTH 64 */
|
||||||
#define UNITY_POINTER_WIDTH 32
|
|
||||||
|
|
||||||
/* Unity will automatically include 64-bit support if it auto-detects it, or if
|
/* Unity will automatically include 64-bit support if it auto-detects it, or if
|
||||||
* your `int`, `long`, or pointer widths are greater than 32-bits. Define this
|
* your `int`, `long`, or pointer widths are greater than 32-bits. Define this
|
||||||
|
@ -119,7 +116,6 @@
|
||||||
#undef UNITY_INCLUDE_64
|
#undef UNITY_INCLUDE_64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* *************************** FLOATING POINT TYPES ****************************
|
/* *************************** FLOATING POINT TYPES ****************************
|
||||||
* In the embedded world, it's not uncommon for targets to have no support for
|
* In the embedded world, it's not uncommon for targets to have no support for
|
||||||
* floating point operations at all or to have support that is limited to only
|
* floating point operations at all or to have support that is limited to only
|
||||||
|
@ -130,11 +126,11 @@
|
||||||
* the only option.
|
* the only option.
|
||||||
**************************************************************************** */
|
**************************************************************************** */
|
||||||
|
|
||||||
/* By default, Unity guesses that you will want single precision floating point
|
/* By default, Unity guesses that you will want single precision floating point
|
||||||
* support, but not double precision. It's easy to change either of these using
|
* support, but not double precision. It's easy to change either of these using
|
||||||
* the include and exclude options here. You may include neither, just float,
|
* the include and exclude options here. You may include neither, just float,
|
||||||
* or both, as suits your needs.
|
* or both, as suits your needs.
|
||||||
*/
|
*/
|
||||||
/* #define UNITY_EXCLUDE_FLOAT */
|
/* #define UNITY_EXCLUDE_FLOAT */
|
||||||
/* #define UNITY_INCLUDE_DOUBLE */
|
/* #define UNITY_INCLUDE_DOUBLE */
|
||||||
/* #define UNITY_EXCLUDE_DOUBLE */
|
/* #define UNITY_EXCLUDE_DOUBLE */
|
||||||
|
@ -190,7 +186,6 @@
|
||||||
/* #define UNITY_FLOAT_PRECISION 0.001f */
|
/* #define UNITY_FLOAT_PRECISION 0.001f */
|
||||||
/* #define UNITY_DOUBLE_PRECISION 0.001f */
|
/* #define UNITY_DOUBLE_PRECISION 0.001f */
|
||||||
|
|
||||||
|
|
||||||
/* *************************** TOOLSET CUSTOMIZATION ***************************
|
/* *************************** TOOLSET CUSTOMIZATION ***************************
|
||||||
* In addition to the options listed above, there are a number of other options
|
* In addition to the options listed above, there are a number of other options
|
||||||
* which will come in handy to customize Unity's behavior for your specific
|
* which will come in handy to customize Unity's behavior for your specific
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
/**
|
/** \file test_dummy.c */
|
||||||
* \file test_dummy.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "unity.h"
|
|
||||||
|
|
||||||
#include "dummy/dummy.h"
|
#include "dummy/dummy.h"
|
||||||
|
#include "unity.h"
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue