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.
|
|
@ -86,7 +86,6 @@
|
|||
* Example:
|
||||
*/
|
||||
/* #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
|
||||
* default, if not autodetected, is 32 bits. This is used to figure out what
|
||||
|
@ -97,7 +96,6 @@
|
|||
* Example:
|
||||
*/
|
||||
/* #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
|
||||
* default, if not autodetected, is 32-bits. If you're getting ugly compiler
|
||||
|
@ -106,7 +104,6 @@
|
|||
* Example:
|
||||
*/
|
||||
/* #define UNITY_POINTER_WIDTH 64 */
|
||||
#define UNITY_POINTER_WIDTH 32
|
||||
|
||||
/* 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
|
||||
|
@ -119,7 +116,6 @@
|
|||
#undef UNITY_INCLUDE_64
|
||||
#endif
|
||||
|
||||
|
||||
/* *************************** FLOATING POINT TYPES ****************************
|
||||
* 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
|
||||
|
@ -190,7 +186,6 @@
|
|||
/* #define UNITY_FLOAT_PRECISION 0.001f */
|
||||
/* #define UNITY_DOUBLE_PRECISION 0.001f */
|
||||
|
||||
|
||||
/* *************************** TOOLSET CUSTOMIZATION ***************************
|
||||
* 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
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/**
|
||||
* \file test_dummy.c
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
/** \file test_dummy.c */
|
||||
|
||||
#include "dummy/dummy.h"
|
||||
#include "unity.h"
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue