Skip to content

Commit 81eabb5

Browse files
committed
Merge commit '138ed035b12f7dd73b11839dc7378c201715e85d' as 'src/note-c'
2 parents c724e4c + 138ed03 commit 81eabb5

File tree

226 files changed

+48548
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+48548
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/docker-existing-dockerfile
3+
{
4+
"name": "Note-C Development Environment Dockerfile",
5+
6+
// Sets the run context to one level up instead of the .devcontainer folder.
7+
"context": "..",
8+
9+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
10+
"image": "ghcr.io/blues/note_c_ci:latest",
11+
// "dockerFile": "../Dockerfile",
12+
13+
// Set *default* container specific settings.json values on container create.
14+
"settings": {},
15+
16+
// Add the IDs of extensions you want installed when the container is created.
17+
"extensions": [
18+
"matepek.vscode-catch2-test-adapter",
19+
"ms-vscode.cpptools",
20+
"shardulm94.trailing-spaces",
21+
"twxs.cmake"
22+
],
23+
24+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
25+
// "forwardPorts": [],
26+
27+
// Uncomment the next line to run commands after the container is created - for example installing curl.
28+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
29+
30+
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
31+
// "runArgs": [
32+
// "--device=/dev/bus/usb/"
33+
// ],
34+
35+
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
36+
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
37+
38+
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
39+
"remoteUser": "blues"
40+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Load note-c CI Docker image'
2+
runs:
3+
using: 'composite'
4+
steps:
5+
- name: Set up Docker Buildx
6+
uses: docker/setup-buildx-action@v2
7+
8+
- name: Download image artifact
9+
uses: actions/download-artifact@v4
10+
with:
11+
name: note_c_ci_image
12+
path: /tmp
13+
14+
- name: Load Docker image
15+
shell: bash
16+
run: |
17+
docker load --input /tmp/note_c_ci_image.tar

src/note-c/.github/workflows/ci.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
name: note-c CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
check_dockerfile_changed:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
changed: ${{ steps.filter.outputs.changed }}
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# TODO: This is a 3rd party GitHub action from some dude. Ideally, we'd
20+
# use something more "official".
21+
- name: Check if Dockerfile changed
22+
uses: dorny/paths-filter@v2
23+
id: filter
24+
with:
25+
base: 'master'
26+
filters: |
27+
changed:
28+
- 'Dockerfile'
29+
30+
build_ci_docker_image:
31+
runs-on: ubuntu-latest
32+
needs: [check_dockerfile_changed]
33+
if: ${{ needs.check_dockerfile_changed.outputs.changed == 'true' }}
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Login to GitHub Container Registry
40+
uses: docker/login-action@v2
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v2
48+
49+
- name: Rebuild image
50+
uses: docker/build-push-action@v4
51+
with:
52+
context: .
53+
load: true
54+
tags: ghcr.io/blues/note_c_ci:latest
55+
outputs: type=docker,dest=/tmp/note_c_ci_image.tar
56+
57+
- name: Upload image artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: note_c_ci_image
61+
path: /tmp/note_c_ci_image.tar
62+
63+
build_docs:
64+
runs-on: ubuntu-latest
65+
if: ${{ always() }}
66+
needs: [build_ci_docker_image]
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Load CI Docker image
73+
# Only load the Docker image artifact if build_ci_docker_image actually
74+
# ran (e.g. it wasn't skipped and was successful).
75+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
76+
uses: ./.github/actions/load-ci-image
77+
78+
- name: Build docs
79+
run: |
80+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/build_docs.sh ghcr.io/blues/note_c_ci:latest
81+
82+
check_libc_dependencies:
83+
runs-on: ubuntu-latest
84+
if: ${{ always() }}
85+
needs: [build_ci_docker_image]
86+
87+
steps:
88+
- name: Checkout code
89+
uses: actions/checkout@v4
90+
91+
- name: Load CI Docker image
92+
# Only load the Docker image artifact if build_ci_docker_image actually
93+
# ran (e.g. it wasn't skipped and was successful).
94+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
95+
uses: ./.github/actions/load-ci-image
96+
97+
- name: Check note-c's libc dependencies
98+
run: |
99+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/check_libc_dependencies.sh ghcr.io/blues/note_c_ci:latest
100+
101+
run_unit_tests:
102+
runs-on: ubuntu-latest
103+
if: ${{ always() }}
104+
needs: [build_ci_docker_image]
105+
106+
steps:
107+
- name: Checkout code
108+
uses: actions/checkout@v4
109+
110+
- name: Load CI Docker image
111+
# Only load the Docker image artifact if build_ci_docker_image actually
112+
# ran (e.g. it wasn't skipped and was successful).
113+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
114+
uses: ./.github/actions/load-ci-image
115+
116+
- name: Run tests
117+
run: |
118+
docker run --rm --volume $(pwd):/note-c/ \
119+
--workdir /note-c/ \
120+
--entrypoint ./scripts/run_unit_tests.sh \
121+
--user root \
122+
ghcr.io/blues/note_c_ci:latest --coverage --mem-check
123+
124+
- name: Adjust lcov source file paths for Coveralls
125+
run: sudo sed -i 's/\/note-c\///g' ./build/test/coverage/lcov.info
126+
127+
- name: Publish test coverage
128+
uses: coverallsapp/github-action@master
129+
with:
130+
github-token: ${{ secrets.GITHUB_TOKEN }}
131+
path-to-lcov: ./build/test/coverage/lcov.info
132+
133+
run_low_mem_unit_tests:
134+
runs-on: ubuntu-latest
135+
if: ${{ always() }}
136+
needs: [build_ci_docker_image]
137+
138+
steps:
139+
- name: Checkout code
140+
uses: actions/checkout@v4
141+
142+
- name: Load CI Docker image
143+
# Only load the Docker image artifact if build_ci_docker_image actually
144+
# ran (e.g. it wasn't skipped and was successful).
145+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
146+
uses: ./.github/actions/load-ci-image
147+
148+
- name: Run tests with NOTE_LOWMEM defined
149+
run: |
150+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/run_unit_tests.sh ghcr.io/blues/note_c_ci:latest --mem-check --low-mem --single-precision
151+
152+
run_astyle:
153+
runs-on: ubuntu-latest
154+
if: ${{ always() }}
155+
needs: [build_ci_docker_image]
156+
157+
steps:
158+
- name: Checkout code
159+
uses: actions/checkout@v4
160+
161+
- name: Load CI Docker image
162+
# Only load the Docker image artifact if build_ci_docker_image actually
163+
# ran (e.g. it wasn't skipped and was successful).
164+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
165+
uses: ./.github/actions/load-ci-image
166+
167+
- name: Run astyle
168+
run: |
169+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/run_astyle.sh ghcr.io/blues/note_c_ci:latest
170+
171+
run_cppcheck:
172+
runs-on: ubuntu-latest
173+
if: ${{ always() }}
174+
needs: [build_ci_docker_image]
175+
176+
steps:
177+
- name: Checkout code
178+
uses: actions/checkout@v4
179+
180+
- name: Load CI Docker image
181+
# Only load the Docker image artifact if build_ci_docker_image actually
182+
# ran (e.g. it wasn't skipped and was successful).
183+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
184+
uses: ./.github/actions/load-ci-image
185+
186+
- name: Run cppcheck
187+
run: |
188+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/run_cppcheck.sh ghcr.io/blues/note_c_ci:latest
189+
190+
publish_ci_image:
191+
runs-on: ubuntu-latest
192+
# Make sure unit tests unit tests passed before publishing.
193+
needs: [build_ci_docker_image, run_unit_tests]
194+
# Only publish the image if this is a push event and the Docker image was rebuilt
195+
if: ${{ github.event_name == 'push' && needs.build_ci_docker_image.result == 'success' }}
196+
197+
steps:
198+
- name: Login to GitHub Container Registry
199+
uses: docker/login-action@v2
200+
with:
201+
registry: ghcr.io
202+
username: ${{ github.actor }}
203+
password: ${{ secrets.GITHUB_TOKEN }}
204+
205+
- name: Set up Docker Buildx
206+
uses: docker/setup-buildx-action@v2
207+
208+
- name: Push image to registry
209+
uses: docker/build-push-action@v4
210+
with:
211+
push: true
212+
tags: ghcr.io/blues/note_c_ci:latest
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: MD5 Server Tests
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call: # reusable workflow
6+
7+
jobs:
8+
test-md5srv: # job id
9+
runs-on: ubuntu-latest
10+
defaults:
11+
run:
12+
shell: bash
13+
env:
14+
TERM: xterm-256color
15+
MD5SRV_TIMEOUT: 5
16+
MD5SRV_DIR: ./test/hitl/scripts
17+
BATS_VERSION: 1.10.0
18+
steps:
19+
- name: Setup Bats and bats libs
20+
id: setup-bats
21+
uses: bats-core/[email protected]
22+
with:
23+
bats-install: true
24+
file-install: false
25+
detik-install: false
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Run Tests
29+
env:
30+
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
31+
run: |
32+
cd ${{env.MD5SRV_DIR}}
33+
bats -p --print-output-on-failure .
34+
- name: Re-run Tests
35+
if: failure()
36+
env:
37+
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
38+
run: |
39+
cd ${{env.MD5SRV_DIR}}
40+
$HOME/.local/bin/bats -p --print-output-on-failure -x .

0 commit comments

Comments
 (0)