Sign inSign up

safdariali/ceedling

By safdariali

โ€ขUpdated 16 days ago

Lightweight Docker image for C unit testing with Ceedling on Alpine Linux.

Image
Developer tools
0

503

safdariali/ceedling repository overview

โ ๐Ÿงช Ceedling Docker for C Unit Testing

Lightweight Docker image providing Ceedling for C unit testing and Test-Driven Development (TDD) on Alpine Linux.

โ โœจ Features

  • ๐Ÿ”ฌ C Unit Testing with Ceedling, Unity, CMock, and CException
  • ๐Ÿ—๏ธ Native C Toolchain: GCC, Make, binutils, musl-dev
  • ๐Ÿณ Lightweight Base: Alpine Linux
  • โšก CI/CD Ready: Designed for GitHub Actions and other CI/CD systems
  • ๐Ÿ“ฆ Reproducible Builds: Explicit version pinning for Ceedling, Ruby, and Alpine

โ ๐Ÿš€ Quick Start

โ Pull the image
docker pull safdariali/ceedling:latest
โ Check Ceedling version
docker run --rm safdariali/ceedling:latest ceedling --version
โ Run a Ceedling project

From the root directory of a Ceedling project:

docker run --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  ceedling test:all

โ ๐Ÿ“– Usage Examples

โ 1. Run all unit tests

Mount the project directory to /workspace:

docker run --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  ceedling test:all

This runs the complete Ceedling test suite.

โ 2. Run a specific test
docker run --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  ceedling test:test_blink

Replace test_blink with the name of the desired test target.

โ 3. Run tests with verbose output
docker run --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  ceedling test:all VERBOSE=1
โ 4. Generate a new Ceedling project
docker run --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  ceedling new my_project

This creates a new Ceedling project in the mounted workspace.

โ 5. Interactive shell

For debugging or inspecting the container environment:

docker run --rm -it \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  /bin/sh
โ 6. Check installed components
docker run --rm safdariali/ceedling:latest ceedling --version

The output includes the installed Ceedling version and its bundled testing frameworks.

โ ๐Ÿท๏ธ Version Tags

Each image is published with both a latest tag and a complete version tag.

TagDescriptionExample
latestLatest published imagesafdariali/ceedling:latest
A.B.C-ruby-X.Y.Z-alpine-N.MComplete version informationsafdariali/ceedling:1.1.2-ruby-4.0.6-alpine-3.24
โ Example
safdariali/ceedling:1.1.2-ruby-4.0.6-alpine-3.24

represents:

Ceedling = 1.1.2 Ruby = 4.0.6 Alpine = 3.24

Using the complete version tag is recommended when reproducibility is important.

The latest tag is intended for users who want the current published image without explicitly selecting component versions.

โ ๐Ÿ”ง GitHub Actions Integration

The image can be used directly as a container in GitHub Actions.

โ Basic unit-test workflow
name: C Unit Tests

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest

    container:
      image: safdariali/ceedling:latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Show Ceedling version
        run: ceedling --version

      - name: Run unit tests
        run: ceedling test:all
โ Using a fixed version

For reproducible CI builds, use a complete image tag:

container:
  image: safdariali/ceedling:1.1.2-ruby-4.0.6-alpine-3.24

This prevents a future latest update from changing the test environment unexpectedly.

โ ๐Ÿ—๏ธ Building from Source

โ Prerequisites
  • Docker
  • Git (optional)
โ Clone the repository
git clone https://github.com/SafdariAli/ceedling-docker.git
cd ceedling-docker
โ Build using Docker directly
docker build \
  --build-arg CEEDLING_VERSION=1.1.2 \
  --build-arg RUBY_VERSION=4.0.6 \
  --build-arg ALPINE_VERSION=3.24 \
  -t safdariali/ceedling:custom \
  .
โ Verify the image
docker run --rm \
  safdariali/ceedling:custom \
  ceedling --version

โ ๐Ÿ–ฅ๏ธ Local Build Scripts

The repository provides scripts for building the image locally.

โ Windows PowerShell
.\build-ceedling-local.ps1

Custom versions can be specified:

.\build-ceedling-local.ps1 `
  -CeedlingVersion "1.1.2" `
  -RubyVersion "4.0.6" `
  -AlpineVersion "3.24"
โ Linux / macOS
chmod +x build-ceedling-local.sh
./build-ceedling-local.sh

Custom versions:

./build-ceedling-local.sh \
  --CeedlingVersion "1.1.2" \
  --RubyVersion "4.0.6" \
  --AlpineVersion "3.24"

The local build scripts:

  1. Check that Docker is available.
  2. Validate the Dockerfile.
  3. Build the image.
  4. Apply the versioned image tag.
  5. Apply the latest tag.
  6. Run a basic Ceedling version test.

โ ๐Ÿ”„ Version Management

The project is designed to keep upstream component versions configurable rather than hard-coded into the Dockerfile.

The main components are:

Ceedling
Ruby
Alpine Linux

Ceedling is distributed as a RubyGem and currently requires Ruby 3.0 or newer.

The Docker image uses the official Ruby Docker image as its base, allowing Ruby and Alpine combinations to be selected through the image tag. The official Ruby image publishes Alpine-based tags such as 4.0.6-alpine3.24.

The project includes automation infrastructure for detecting newer upstream versions and updating the build configuration.

The goal is to make updating the image reproducible while keeping the repository itself minimal.

โ ๐Ÿงช Testing

The image performs a basic installation test during the Docker build:

RUN ceedling --version

A successful image build therefore verifies that Ceedling can be installed and executed inside the container.

After building the image locally, an additional test can be performed:

docker run --rm safdariali/ceedling:latest ceedling --version

For actual projects, the recommended validation is to mount the project and execute:

docker run --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  safdariali/ceedling:latest \
  ceedling test:all```

## ๐Ÿ“ฆ Docker Image

The published image is available from Docker Hub:

```text
safdariali/ceedling

Pull the latest version:

docker pull safdariali/ceedling:latest

Pull a specific version:

docker pull safdariali/ceedling:1.1.2-ruby-4.0.6-alpine-3.24

โ ๐Ÿ“„ License

This repository contains Docker packaging and automation for Ceedling.

โ Packaging

The Dockerfile, build scripts, documentation, and other original files in this repository are licensed under the MIT License.

โ Included software

The Docker image contains third-party software distributed under their respective licenses, including:

  • Ceedling โ€” MIT License
  • Ruby โ€” Ruby License / BSD-style terms
  • Alpine Linux โ€” various licenses depending on included packages
  • GCC โ€” GNU General Public License and related licenses
  • binutils โ€” GNU General Public License and related licenses
  • musl โ€” MIT License and related licenses
  • Unity, CMock, and CException โ€” their respective upstream licenses

The MIT license in this repository applies to the original packaging and automation provided by this project. It does not replace or modify the licenses of the software included in the Docker image.

See the LICENSE file and the respective upstream projects for complete license terms.

โ ๐Ÿค Support

  • Maintainer: Mohammad Ali Safdari
  • Email: m.ali.safdari [at] gmail [dot] com
  • GitHub: SafdariAli
  • Docker Hub: safdariali
  • Issues: Feature requests, bug reports, and suggestions are welcome through GitHub Issues.

โ ๐ŸŒŸ Show Your Support

If you find this image useful:

  • โญ Star the GitHub repository
  • ๐Ÿณ Pull the Docker image
  • ๐Ÿ“ข Share it with your team

Happy Testing with Ceedling! ๐ŸŒฑ

Tag summary

Content type

Image

Digest

sha256:6dc82e449โ€ฆ

Size

121.6 MB

Last updated

16 days ago

docker pull safdariali/ceedling