Skip to content

Commit

Permalink
build with github actions and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamilcuk committed Oct 25, 2024
1 parent 5625c01 commit 2d4561c
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 134 deletions.
10 changes: 7 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.cache
./_build
compile_commands.json
*
!src
!scripts
!tests
!CMakeLists.txt
!Makefile
!.git
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
on:
- push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
target:
- alpine
- gcc
- clang
- intel
runs-on: nomadtools mem=500
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: hadolint/[email protected]
- run: DOCKER_BUILDKIT=1 docker build --pull --target ${{matrix.target}} .

42 changes: 42 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: nomadtools
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- run: DOCKER_BUILDKIT=1 docker build --target doxygen --output public .
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
61 changes: 0 additions & 61 deletions .gitlab-ci.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
ignored:
- DL3006
- DL3008
- DL3013
- DL3018
- DL3006
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ if(CKD_DEV)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_link_options(
# compiler-rt provides symbols for __builtin_*_overflow for clang
-rtlib=compiler-rt)
# -rtlib=compiler-rt
)
endif()
if(CKD_COVERAGE)
add_compile_definitions(CKD_COVERAGE=1)
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM alpine:latest AS abase

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (alpine)

DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (gcc)

DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (clang)

DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (intel)

DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag
RUN apk add --no-cache py3-jinja2 cmake build-base ninja git doxygen graphviz

FROM abase AS alpine
WORKDIR /app
COPY . .
RUN make CONFARGS=-DCKD_NOSANITIZE=1 CC=gcc

FROM abase AS make_doxygen
WORKDIR /app
COPY . .
RUN make doxygen

FROM scratch AS doxygen
COPY --from=make_doxygen /app/public .

Check failure on line 15 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (alpine)

DL3045 warning: `COPY` to a relative destination without `WORKDIR` set.

Check failure on line 15 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (gcc)

DL3045 warning: `COPY` to a relative destination without `WORKDIR` set.

Check failure on line 15 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (clang)

DL3045 warning: `COPY` to a relative destination without `WORKDIR` set.

Check failure on line 15 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (intel)

DL3045 warning: `COPY` to a relative destination without `WORKDIR` set.

###############################################################################

FROM ubuntu AS base
RUN printf "%s\n" 'APT::Install-Suggests "0";' 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_BREAK_SYSTEM_PACKAGES=1
RUN set -x && \
apt-get update && \
apt-get install -y --no-install-recommends \
cmake ninja-build make clang gcc python3-pip git time && \
pip3 --no-cache-dir install jinja2 && \
rm -rf /var/lib/apt/lists/*

FROM base AS clang
WORKDIR /app
COPY . .
RUN make CC=clang

FROM base AS gcc
WORKDIR /app
COPY . .
RUN make CC=gcc

FROM intel/oneapi AS intel
RUN printf "%s\n" 'APT::Install-Suggests "0";' 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_BREAK_SYSTEM_PACKAGES=1
RUN set -x && \
apt-get update && \
apt-get install -y --no-install-recommends \
cmake ninja-build make python3-pip git time && \
pip3 --no-cache-dir install jinja2 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN make CC=icx-cc CONFARGS=-DCKD_NOSANITIZE=1

3 changes: 0 additions & 3 deletions Dockerfile.gcc

This file was deleted.

5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ MAKEFLAGS = -rR --no-print-directories --warn-undefined-variables
unexport MAKEFLAGS
.NOTPARALLEL:

CONFARGS = $(shell hash ninja 2>/dev/null && echo -GNinja)
CONFARGS ?=
GENERATOR = $(shell hash ninja 2>/dev/null && echo -GNinja)
TIME = $(shell hash time 2>/dev/null && echo time)
NICE = ionice -c 3 nice -n 40
RUN = $(shell \
Expand Down Expand Up @@ -37,7 +38,7 @@ JOBS ?=
all: test

config:
$(NICE) cmake -S. -B$(B) -DCKD_DEV=1 --check-system-vars --log-context -Werror=dev -Wdev $(CONFARGS) $(ARGS)
$(NICE) cmake -S. -B$(B) -DCKD_DEV=1 --check-system-vars --log-context -Werror=dev -Wdev $(GENERATOR) $(CONFARGS) $(ARGS)
build: config
$(RUN) $(NICE) $(TIME) cmake --build $(B) -j $(JOBS) $(if $(value VERBOSE),--verbose) $(if $(value TARGETS),--target $(TARGETS))
gen: config
Expand Down
1 change: 0 additions & 1 deletion sampleusage/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions sampleusage/CMakeLists.txt

This file was deleted.

18 changes: 0 additions & 18 deletions sampleusage/Makefile

This file was deleted.

17 changes: 0 additions & 17 deletions sampleusage/example-CPM.cmake

This file was deleted.

10 changes: 0 additions & 10 deletions sampleusage/example-fetchcontent.cmake

This file was deleted.

10 changes: 0 additions & 10 deletions sampleusage/main.c

This file was deleted.

0 comments on commit 2d4561c

Please sign in to comment.