ops: Add gitea actions CI #1

Merged
brock merged 19 commits from feature/gitea_actions into main 2024-01-27 23:18:48 -08:00
5 changed files with 50 additions and 49 deletions

View File

@@ -7,8 +7,7 @@
}, },
"workspaceMount": "", "workspaceMount": "",
"runArgs": [ "runArgs": [
"--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z", "--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z"
"--platform=linux/amd64"
], ],
"customizations": { "customizations": {
"vscode": { "vscode": {

View File

@@ -16,16 +16,25 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2 - uses: docker/setup-buildx-action@v2
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- -
name: Create docker cache folder name: Create docker cache folder
run: mkdir -p /tmp/docker run: mkdir -p /tmp/docker
-
name: Hash dockerfile
id: dockerfile-hash
uses: https://gitea.com/actions/go-hashfiles@v0.0.1
with:
patterns: builder.Dockerfile
- -
name: Restore docker image name: Restore docker image
id: cache-docker id: cache-docker
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: /tmp/docker path: /tmp/docker
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }} key: ${{ runner.os }}-docker-${{ steps.dockerfile-hash.outputs.hash }}
- -
name: Build docker builder-image name: Build docker builder-image
if: steps.cache-docker.outputs.cache-hit != 'true' if: steps.cache-docker.outputs.cache-hit != 'true'
@@ -42,38 +51,38 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2 - uses: docker/setup-buildx-action@v2
- uses: actions/setup-go@v3
with:
go-version: '1.20'
-
name: Hash dockerfile
id: dockerfile-hash
uses: https://gitea.com/actions/go-hashfiles@v0.0.1
with:
patterns: builder.Dockerfile
- -
name: Restore docker image name: Restore docker image
id: cache-docker id: cache-docker
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: /tmp/docker path: /tmp/docker
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }} key: ${{ runner.os }}-docker-${{ steps.dockerfile-hash.outputs.hash }}
-
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
--platform linux/amd64 \ options: --volumes-from ${{ env.JOB_CONTAINER_NAME }}
--workdir /builder/mnt \ run: |
-v ${{ github.workspace }}:/builder/mnt \ /bin/bash -c "cd ${{ github.workspace }}; rm -rf build; cmake -B build; cmake --build build"
cproject-builder:latest \
/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
--platform linux/amd64 \ options: --volumes-from ${{ env.JOB_CONTAINER_NAME }}
--workdir /builder/mnt/tests/unittest \ run: |
-v ${{ github.workspace }}:/builder/mnt \ /bin/bash -c "cd ${{ github.workspace }}/tests/unittest; ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
cproject-builder:latest \
/bin/bash -c "ceedling clobber; ceedling gcov:all; ceedling utils:gcov"
- -
name: Archive coverage results name: Archive coverage results
shell: bash shell: bash

View File

@@ -2,7 +2,7 @@ ARG base_tag=bullseye
ARG base_img=mcr.microsoft.com/vscode/devcontainers/base:dev-${base_tag} ARG base_img=mcr.microsoft.com/vscode/devcontainers/base:dev-${base_tag}
# ARG base_img=debian:${base_tag} # ARG base_img=debian:${base_tag}
FROM --platform=linux/amd64 ${base_img} AS builder-install FROM ${base_img} AS builder-install
# the following shows how to install the latest version of a package. # the following shows how to install the latest version of a package.
# you can determine the installed version with `apt-cache policy <list of packages>` and fix # you can determine the installed version with `apt-cache policy <list of packages>` and fix
@@ -15,7 +15,6 @@ RUN apt-get install -y --no-install-recommends \
cmake \ cmake \
build-essential \ build-essential \
gcc \ gcc \
g++-multilib \
locales \ locales \
make \ make \
ruby \ ruby \
@@ -61,29 +60,28 @@ RUN ln -s /usr/bin/clang-tidy-${llvm_version} /usr/local/bin/clang-tidy
# this can take a significant amount of time (e.g., several minutes just to compile one tool), # this can take a significant amount of time (e.g., several minutes just to compile one tool),
# and also increases the image size significantly. therefore, we go for option B below. # and also increases the image size significantly. therefore, we go for option B below.
# RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
# ENV PATH=/root/.cargo/bin:$PATH ENV PATH=/root/.cargo/bin:$PATH
# Each takes around 280 s to build on an M2 macbook air # Each takes around 280 s to build on an M2 macbook air
# RUN cargo install run-clang-format RUN cargo install run-clang-format
# RUN cargo install run-clang-tidy RUN cargo install run-clang-tidy
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# option B: install pre-built clang wrappers # option B: install pre-built clang wrappers
# RUN mkdir -p /usr/local/run-clang-format
# RUN wget -O clang-utils.tgz "https://github.com/lmapii/run-clang-format/releases/download/v1.4.14/run-clang-format-v1.4.14-i686-unknown-linux-gnu.tar.gz" && \
# tar -C /usr/local/run-clang-format -xzf clang-utils.tgz --strip-components 1 && \
# rm clang-utils.tgz
# ENV PATH /usr/local/run-clang-format:$PATH
# RUN run-clang-format --version
RUN mkdir -p /usr/local/run-clang-format # RUN mkdir -p /usr/local/run-clang-tidy
RUN wget -O clang-utils.tgz "https://github.com/lmapii/run-clang-format/releases/download/v1.4.14/run-clang-format-v1.4.14-i686-unknown-linux-gnu.tar.gz" && \ # RUN wget -O clang-utils.tgz "https://github.com/lmapii/run-clang-tidy/releases/download/v0.2.5/run-clang-tidy-v0.2.5-i686-unknown-linux-gnu.tar.gz" && \
tar -C /usr/local/run-clang-format -xzf clang-utils.tgz --strip-components 1 && \ # tar -C /usr/local/run-clang-tidy -xzf clang-utils.tgz --strip-components 1 && \
rm clang-utils.tgz # rm clang-utils.tgz
ENV PATH /usr/local/run-clang-format:$PATH # ENV PATH /usr/local/run-clang-tidy:$PATH
RUN run-clang-format --version # RUN run-clang-tidy --version
RUN mkdir -p /usr/local/run-clang-tidy
RUN wget -O clang-utils.tgz "https://github.com/lmapii/run-clang-tidy/releases/download/v0.2.5/run-clang-tidy-v0.2.5-i686-unknown-linux-gnu.tar.gz" && \
tar -C /usr/local/run-clang-tidy -xzf clang-utils.tgz --strip-components 1 && \
rm clang-utils.tgz
ENV PATH /usr/local/run-clang-tidy:$PATH
RUN run-clang-tidy --version
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# install unity and ceedling # install unity and ceedling

View File

@@ -7,7 +7,6 @@ builder-run :
docker run \ docker run \
--rm \ --rm \
-it \ -it \
--platform linux/amd64 \
--workdir /builder/mnt \ --workdir /builder/mnt \
-v .:/builder/mnt \ -v .:/builder/mnt \
$(project_name)-builder:latest \ $(project_name)-builder:latest \

View File

@@ -102,24 +102,20 @@
- -Wall - -Wall
- -g0 - -g0
- -O3 - -O3
- -m32
:link: :link:
:*: :*:
- -g0 - -g0
- -O3 - -O3
- -m32
:gcov: :gcov:
:compile: :compile:
:*: :*:
- -g0 - -g0
- -O3 - -O3
- -Wall - -Wall
- -m32
:link: :link:
:*: :*:
- -g0 - -g0
- -O3 - -O3
- -m32
# LIBRARIES # LIBRARIES