diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5f1a8b8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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. diff --git a/tests/unittest/support/unity_config.h b/tests/unittest/support/unity_config.h index 0eed458..5f9d5da 100644 --- a/tests/unittest/support/unity_config.h +++ b/tests/unittest/support/unity_config.h @@ -80,13 +80,12 @@ * 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. * * 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 @@ -130,11 +126,11 @@ * the only option. **************************************************************************** */ - /* 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 - * the include and exclude options here. You may include neither, just float, - * or both, as suits your needs. - */ +/* 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 + * the include and exclude options here. You may include neither, just float, + * or both, as suits your needs. + */ /* #define UNITY_EXCLUDE_FLOAT */ /* #define UNITY_INCLUDE_DOUBLE */ /* #define UNITY_EXCLUDE_DOUBLE */ @@ -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 diff --git a/tests/unittest/test/test_dummy.c b/tests/unittest/test/test_dummy.c index e65b2f0..676464e 100644 --- a/tests/unittest/test/test_dummy.c +++ b/tests/unittest/test/test_dummy.c @@ -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) {