Skip to content

Commit

Permalink
Merge pull request #12 from zMynxx/feature/test-cd-1
Browse files Browse the repository at this point in the history
Feature/test cd 1
  • Loading branch information
zMynxx authored Feb 29, 2024
2 parents 0a9dbd2 + 91fd1f6 commit 3d249d6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 81 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
ref: ${{ github.pull_request.head.ref }}
fetch-depth: 0

- name: Set up QEMU
Expand All @@ -42,12 +42,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build locally
uses: docker/[email protected]
with:
Expand All @@ -56,7 +50,7 @@ jobs:
platforms: linux/amd64
push: false
load: true
tags: ${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:${{ github.sha }}
tags: release:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -66,7 +60,7 @@ jobs:
--interactive \
--rm \
--volume ./project-demo:/project \
${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:${{ github.sha }} \
release:${{ github.sha }} \
ceedling release
- name: Semantic Versioning
Expand All @@ -80,7 +74,7 @@ jobs:
id: downcase
shell: bash
env:
PR_BODY: ${{ github.event.pull_request.body }}
PR_BODY: ${{ github.pull_request.body }}
run: echo "pr_body_lowercase=${PR_BODY,,}" >> $GITHUB_OUTPUT

- name: Parse the body for any '#major' or '#minor' keywords
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build locally
uses: docker/[email protected]
with:
Expand All @@ -38,7 +32,7 @@ jobs:
platforms: linux/amd64
push: false
load: true
tags: ${{ vars.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_USERNAME }}:${{ github.sha }}
tags: tests:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -48,5 +42,5 @@ jobs:
--interactive \
--rm \
--volume ./project-demo:/project \
${{ vars.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_USERNAME }}:${{ github.sha }} \
tests:${{ github.sha }} \
ceedling test:all
20 changes: 11 additions & 9 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ name: Publish
on:
# Publish a new image to Dockerhub on changes to Dockerfile
push:
branches:
- main
paths:
- Dockerfile.ubuntu

Expand All @@ -13,16 +15,8 @@ permissions:
contents: write

jobs:
check:
name: check pr status
runs-on: ubuntu-22.04
steps:
- name: check if PR is merged
uses: zmynx/github-actions/.github/actions/git/check-merge@feature/gha

cd:
name: publish-dockerhub
needs: [check]
name: Docker Ceedling test:all
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand All @@ -40,6 +34,12 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}

# In case of a new image I'd like to publish
- name: Publish image to DockerHub
uses: docker/[email protected]
Expand All @@ -48,7 +48,9 @@ jobs:
file: Dockerfile.ubuntu
platforms: linux/amd64
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ steps.meta.outputs.tags }}
${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:22.04-v0.32.0-d76db35-${{ github.sha }}
${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:latest
cache-from: type=gha
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/trunk-cache.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/trunk-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
name: Trunk Check Runner
runs-on: ubuntu-latest
permissions:
actions: write # For caching
checks: write # For trunk to post annotations
contents: read # For repo checkout

Expand All @@ -22,3 +23,5 @@ jobs:

- name: Trunk Check
uses: trunk-io/[email protected]
with:
check-mode: populate_cache_only
39 changes: 39 additions & 0 deletions .trunk/configs/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Checks: >-
bugprone-*,
cppcoreguidelines-*,
google-*,
misc-*,
modernize-*,
performance-*,
readability-*,
-bugprone-lambda-function-name,
-bugprone-reserved-identifier,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-type-vararg,
-google-readability-braces-around-statements,
-google-readability-function-size,
-misc-no-recursion,
-modernize-return-braced-init-list,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-performance-unnecessary-value-param,
-readability-magic-numbers,
CheckOptions:
- key: readability-function-cognitive-complexity.Threshold
value: 100
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true
# Set naming conventions for your style below (there are dozens of naming settings possible):
# See https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html
# - key: readability-identifier-naming.ClassCase
# value: CamelCase
# - key: readability-identifier-naming.NamespaceCase
# value: lower_case
# - key: readability-identifier-naming.PrivateMemberSuffix
# value: _
# - key: readability-identifier-naming.StructCase
# value: CamelCase
1 change: 1 addition & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ runtimes:
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
Expand Down
36 changes: 8 additions & 28 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM ubuntu:22.04 as base

MAINTAINER [email protected]
LABEL maintainer.description='C Development environment'
LABEL ceedling.version=v0.31.1
LABEL maintainer.description='C Development environment with ceedling, cmock unity, and doxygen'
LABEL ceedling.version=ceedling-0.32.0-d76db35
LABEL unity.version=2.5.4
LABEL cmock.version=2.5.4
LABEL cexception.version=1.3.3
LABEL doxygen.version=v1.9.1

# Install the required packages
Expand Down Expand Up @@ -45,12 +48,11 @@ RUN apt-get clean &&\
# RUN timedatectl set-timezone $TZ

# Install rbenv-build
#RUN curl --fail --silent --show-error --location https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
RUN curl --fail --silent --show-error --location https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
ENV PATH="$PATH:/root/.rbenv/bin:/root/.rbenv/shims"

# Validate rbenv using rbev-doctor
RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-doctor | bash
RUN curl --fail --silent --show-error --location https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-doctor | bash
RUN echo 'eval "$(~/.rbenv/bin/rbenv init -)"' >> /etc/profile.d/rbenv.sh

# Install rbenv and set the desired version
Expand All @@ -63,29 +65,7 @@ RUN rbenv install $RBENV_VERSION &&\
COPY ./ceedling-0.32.0-d76db35.gem ceedling-0.32.0-d76db35.gem
RUN gem install constructor deep_merge thor
RUN gem install --local ./ceedling-0.32.0-d76db35.gem
HEALTHCHECK --interval=35s --timeout=4s --retries=2 CMD ceedling version || exit 1

################################################################################
# Create a final stage for running your application.
#
# The following commands copy the output from the "build" stage above and tell
# the container runtime to execute it when the image is run. Ideally this stage
# contains the minimal runtime dependencies for the application as to produce
# the smallest image possible. This often means using a different and smaller
# image than the one used for building the application, but for illustrative
# purposes the "base" image is used here.
# FROM base AS final
#
# # Create a non-privileged user that the app will run under.
# # See https://docs.docker.com/go/dockerfile-user-best-practices/
# ARG UID=10001
# ARG USER=ubuntu
# ENV USER $USER
# RUN useradd \
# --uid "${UID}" \
# --create-home \
# --shell "/bin/bash" \
# --groups sudo \
# $USER
# USER $USER
WORKDIR /project
CMD bash
6 changes: 4 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ services:
args:
- RBENV_VERSION=3.3.0
labels:
- [email protected]
- maintainer.description=C Development environment
- maintainer.description='C Development environment with ceedling, cmock unity, and doxygen'
- ceedling.version=ceedling-0.32.0-d76db35
- unity.version=2.5.4
- cmock.version=2.5.4
- cexception.version=1.3.3
- doxygen.version=v1.9.1
tty: true
stdin_open: true
Expand Down

0 comments on commit 3d249d6

Please sign in to comment.