Compare commits
9 Commits
57cccd1cf2
...
fix/remove
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
324b0f0eef | ||
| b0a2528514 | |||
|
|
54978e7e31 | ||
|
|
9f9122a402 | ||
|
|
47f7e5a4cc | ||
|
|
0bc03b3ed3 | ||
|
|
b6f7fcbd24 | ||
|
|
c826a4ecd8 | ||
| dce7d3492d |
@@ -8,85 +8,49 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '0 1 * * 0'
|
- cron: '0 1 * * 0'
|
||||||
|
|
||||||
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
|
|
||||||
# just using caches instead of artifact upload.
|
|
||||||
jobs:
|
jobs:
|
||||||
docker-build:
|
docker-build-and-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: docker/setup-buildx-action@v2
|
- uses: docker/setup-buildx-action@v2
|
||||||
-
|
|
||||||
name: Create docker cache folder
|
|
||||||
run: mkdir -p /tmp/docker
|
|
||||||
-
|
|
||||||
name: Restore docker image
|
|
||||||
id: cache-docker
|
|
||||||
uses: https://github.com/actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: /tmp/docker
|
|
||||||
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }}
|
|
||||||
-
|
-
|
||||||
name: Build docker builder-image
|
name: Build docker builder-image
|
||||||
if: steps.cache-docker.outputs.cache-hit != 'true'
|
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: builder.Dockerfile
|
file: builder.Dockerfile
|
||||||
tags: cproject-builder:latest
|
tags: cproject-builder:latest
|
||||||
outputs: type=docker,dest=/tmp/docker/${{ runner.os }}-builder-image.tar
|
push: false
|
||||||
|
load: true
|
||||||
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: https://github.com/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
|
name: Build library
|
||||||
run: |
|
uses: https://github.com/addnab/docker-run-action@v3
|
||||||
docker run \
|
with:
|
||||||
--rm \
|
image: cproject-builder:latest
|
||||||
--workdir /builder/mnt \
|
options: --volumes-from ${{ env.JOB_CONTAINER_NAME }}
|
||||||
-v ${{ gitea.workspace }}:/builder/mnt \
|
run: |
|
||||||
cproject-builder:latest \
|
/bin/bash -c "cd ${{ github.workspace }}; rm -rf build; cmake -B build; cmake --build build"
|
||||||
/bin/bash -c "rm -rf build; cmake -B build; cmake --build build"
|
|
||||||
-
|
-
|
||||||
name: Test library
|
name: Test library
|
||||||
run: |
|
uses: https://github.com/addnab/docker-run-action@v3
|
||||||
docker run \
|
with:
|
||||||
--rm \
|
image: cproject-builder:latest
|
||||||
--workdir /builder/mnt/tests/unittest \
|
options: --volumes-from ${{ env.JOB_CONTAINER_NAME }}
|
||||||
-v ${{ gitea.workspace }}:/builder/mnt \
|
run: |
|
||||||
cproject-builder:latest \
|
/bin/bash -c "cd ${{ github.workspace }}/tests/unittest; ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
|
||||||
/bin/bash -c "ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
|
|
||||||
-
|
-
|
||||||
name: Archive coverage results
|
name: Archive coverage results
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
staging="reports-${{gitea.run_number}}"
|
staging="reports-${{github.run_number}}"
|
||||||
mkdir -p "$staging"
|
mkdir -p "$staging"
|
||||||
cp -r tests/unittest/build/artifacts/gcov "$staging"
|
cp -r tests/unittest/build/artifacts/gcov "$staging"
|
||||||
tar czf "$staging.tar.gz" "$staging"
|
echo "ASSET=$staging" >> $GITHUB_ENV
|
||||||
echo "ASSET=$staging.tar.gz" >> $GITEA_ENV
|
|
||||||
-
|
-
|
||||||
name: Archive artifacts
|
name: Archive artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: reports-${{gitea.run_number}}
|
name: reports-${{github.run_number}}
|
||||||
path: ${{ env.ASSET }}
|
path: ${{ env.ASSET }}
|
||||||
retention-days: 3
|
retention-days: 3
|
||||||
|
|
||||||
# TODO: delete cache on merge.
|
|
||||||
|
|||||||
@@ -23,3 +23,16 @@ target_include_directories(
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(
|
||||||
|
NAME coverage
|
||||||
|
COMMAND bash -c "ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/unittest
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME ceedling
|
||||||
|
COMMAND bash -c "ceedling clobber; ceedling test:all"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/unittest
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
[](https://github.com/lmapii/cproject/actions)
|
|
||||||
|
|
||||||
# Example repository for a C development environment
|
# Example repository for a C development environment
|
||||||
|
|
||||||
This is the example repository for a [post on the Interrupt blog](https://interrupt.memfault.com/blog/a-modern-c-dev-env). It is a demo development environment using Docker, CMake, Unity, and GitHub Actions.
|
This is the example repository for a [post on the Interrupt blog](https://interrupt.memfault.com/blog/a-modern-c-dev-env). It is a demo development environment using Docker, CMake, Unity, and Gitea (ported from Guthub) Actions.
|
||||||
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 450 KiB |
|
Before Width: | Height: | Size: 588 KiB |
|
Before Width: | Height: | Size: 498 KiB |
|
Before Width: | Height: | Size: 487 KiB |
|
Before Width: | Height: | Size: 463 KiB |