Compare commits

..

9 Commits

Author SHA1 Message Date
Brock Allen
57cccd1cf2 ops: Fix caching
Some checks failed
ci / docker-build (pull_request) Waiting to run
ci / build-and-test (pull_request) Has been cancelled
2024-01-28 01:01:40 +00:00
Brock Allen
13bcb67fa5 test: Remove -m32 flag 2024-01-28 00:35:27 +00:00
Brock Allen
2fae1da76f ops: refactor github -> gitea
Some checks failed
ci / docker-build (pull_request) Successful in 24m56s
ci / build-and-test (pull_request) Failing after 8m11s
2024-01-27 23:30:44 +00:00
Brock Allen
bf1882e528 ops: Remove g++-multilib
Some checks failed
ci / docker-build (pull_request) Successful in 24m24s
ci / build-and-test (pull_request) Failing after 1m5s
g++-multilib is not availble on arm64 images and causes CI/CD to fail.
2024-01-27 23:02:42 +00:00
Brock Allen
94c1ad26d5 fix: typos
Some checks failed
ci / docker-build (pull_request) Failing after 3m35s
ci / build-and-test (pull_request) Has been skipped
2024-01-27 23:00:25 +00:00
Brock Allen
8712d22ff5 ops(dockerfile): Build rust and clang wrappers from source
Some checks failed
ci / docker-build (pull_request) Failing after 58s
ci / build-and-test (pull_request) Has been skipped
2024-01-27 22:57:32 +00:00
Brock Allen
2df45c01ff ops: Remove amd64 platform limitation
Some checks failed
ci / docker-build (pull_request) Failing after 5m42s
ci / build-and-test (pull_request) Has been skipped
2024-01-27 22:47:35 +00:00
Brock Allen
105c1be3df ops: Add logging to CI
Some checks failed
ci / docker-build (pull_request) Failing after 16m46s
ci / build-and-test (pull_request) Has been skipped
2024-01-27 22:31:04 +00:00
Brock Allen
716962af71 ops: Add gitea actions CI 2024-01-27 22:24:38 +00:00
11 changed files with 57 additions and 32 deletions

View File

@@ -8,49 +8,85 @@ on:
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-and-test:
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: https://github.com/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
push: false
load: true
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: 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
uses: https://github.com/addnab/docker-run-action@v3
with:
image: cproject-builder:latest
options: --volumes-from ${{ env.JOB_CONTAINER_NAME }}
run: |
/bin/bash -c "cd ${{ github.workspace }}; rm -rf build; cmake -B build; cmake --build build"
docker run \
--rm \
--workdir /builder/mnt \
-v ${{ gitea.workspace }}:/builder/mnt \
cproject-builder:latest \
/bin/bash -c "rm -rf build; cmake -B build; cmake --build build"
-
name: Test library
uses: https://github.com/addnab/docker-run-action@v3
with:
image: cproject-builder:latest
options: --volumes-from ${{ env.JOB_CONTAINER_NAME }}
run: |
/bin/bash -c "cd ${{ github.workspace }}/tests/unittest; ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
docker run \
--rm \
--workdir /builder/mnt/tests/unittest \
-v ${{ gitea.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}}"
staging="reports-${{gitea.run_number}}"
mkdir -p "$staging"
cp -r tests/unittest/build/artifacts/gcov "$staging"
echo "ASSET=$staging" >> $GITHUB_ENV
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITEA_ENV
-
name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: reports-${{github.run_number}}
name: reports-${{gitea.run_number}}
path: ${{ env.ASSET }}
retention-days: 3
# TODO: delete cache on merge.

View File

@@ -23,16 +23,3 @@ target_include_directories(
PUBLIC
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
)

BIN
assets/docker-sharing.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
assets/gcovr-report.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
assets/github-action.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

BIN
assets/vscode-container.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

BIN
assets/vscode-rebuild.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 KiB

BIN
assets/vscode-reload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

BIN
assets/vscode-remote.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 KiB

View File

View File

@@ -1,4 +1,6 @@
[![Build status](https://github.com/lmapii/cproject/workflows/ci/badge.svg)](https://github.com/lmapii/cproject/actions)
# 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 Gitea (ported from Guthub) 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 GitHub Actions.