Skip to content

Commit

Permalink
Merge branch 'fixes/1_0_0_packages_messages'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarlesky committed Jan 24, 2025
2 parents eabe1b0 + 82d9fd4 commit 6f25a00
Show file tree
Hide file tree
Showing 33 changed files with 492 additions and 752 deletions.
232 changes: 209 additions & 23 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,61 @@ on:
workflow_dispatch:
push:
branches:
- '*'
- "**"
pull_request:
branches:
- 'main'
- "main"

env:
IMAGE_BASE_NAME: 'throwtheswitch/madsciencelab'
IMAGE_ORG: 'throwtheswitch'
IMAGE_BASE_NAME: 'madsciencelab'


jobs:
# Jobs organized for concurrent Docker image builds
# Jobs only build :latest images without pushing to Docker Hub

# This is a workaround to the limitation that an `env:` map cannot reference the `env:` map to create additional environment variables
image-details:
runs-on: ubuntu-latest
steps:
# A step must be present in order to make use of `outputs:`
- run: echo "Setting Docker image details..."
outputs:
base-name: 'madsciencelab'
base-url: 'throwtheswitch/madsciencelab'

madsciencelab:
runs-on: ubuntu-latest
needs: [image-details]
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
IMAGE_NAME: ${{ needs.image-details.outputs.base-name }}
IMAGE_URL: ${{ needs.image-details.outputs.base-url }}
# Image variant name is drawn from final `--dir` entry in file generation command line
IMAGE_DIR: build/standard

steps:
- name: 'Set up Ruby for generation tool'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: 'Install file generation Ruby dependencies'
run: bundle install

- name: 'Run file generation'
id: file-gen
run: bash build.sh --dir ${{ env.IMAGE_DIR }} --version dev

- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v3

Expand All @@ -44,28 +74,61 @@ jobs:

# Docker image: madsciencelab
# Note: standard/ directory maps to madsciencelab image (no variants)
- name: 'Build Docker image ${{ env.IMAGE_BASE_NAME }}'
- name: 'Build Docker image ${{ env.IMAGE_NAME }}'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: build/standard/docker/Dockerfile
build-args: CONTAINER_VERSION=${{ github.ref_name }}
tags: ${{ env.IMAGE_BASE_NAME }}:latest
context: .
file: ${{ env.IMAGE_DIR }}/docker/Dockerfile
build-args: |
CONTAINER_VERSION=${{ github.ref_name }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_URL }}:latest
# Connect Docker driver to GitHub Action cache service
cache-from: type=gha
cache-to: type=gha,mode=max

# Zip generated files as a single artifact
- name: 'Archive ${{ env.IMAGE_NAME }} generated files as a single artifact'
run: zip -j ${{ env.IMAGE_NAME }}.zip ${{ env.IMAGE_DIR }}/docker/Dockerfile ${{ env.IMAGE_DIR }}/assets/shell/welcome

# Upload the zip artifact
- uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.IMAGE_NAME }}.zip
if-no-files-found: error

madsciencelab-plugins:
runs-on: ubuntu-latest
needs: [image-details]
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
VARIANT: plugins
env:
IMAGE_NAME: ${{ needs.image-details.outputs.base-name }}-plugins
IMAGE_URL: ${{ needs.image-details.outputs.base-url }}-plugins
# Image variant name is drawn from final `--dir` entry in file generation command line
IMAGE_DIR: build/plugins

steps:
- name: 'Set up Ruby for generation tool'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: 'Install file generation Ruby dependencies'
run: bundle install

- name: 'Run file generation'
run: bash build.sh --dir build/standard --dir ${{ env.IMAGE_DIR }} --version dev

- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v3

Expand All @@ -80,28 +143,61 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab-plugins
- name: 'Build Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}'
- name: 'Build Docker image ${{ env.IMAGE_NAME }}'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: build/${{ env.VARIANT }}/docker/Dockerfile
build-args: CONTAINER_VERSION=${{ github.ref_name }}
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
context: .
file: ${{ env.IMAGE_DIR }}/docker/Dockerfile
build-args: |
CONTAINER_VERSION=${{ github.ref_name }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_URL }}:latest
# Connect Docker driver to GitHub Action cache service
cache-from: type=gha
cache-to: type=gha,mode=max

# Zip generated files as a single artifact
- name: 'Archive ${{ env.IMAGE_NAME }} generated files as a single artifact'
run: zip -j ${{ env.IMAGE_NAME }}.zip ${{ env.IMAGE_DIR }}/docker/Dockerfile ${{ env.IMAGE_DIR }}/assets/shell/welcome

# Upload the zip artifact
- uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.IMAGE_NAME }}.zip
if-no-files-found: error

madsciencelab-arm-none-eabi:
runs-on: ubuntu-latest
needs: [image-details]
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
VARIANT: arm-none-eabi
IMAGE_NAME: ${{ needs.image-details.outputs.base-name }}-arm-none-eabi
IMAGE_URL: ${{ needs.image-details.outputs.base-url }}-arm-none-eabi
# Image variant name is drawn from final `--dir` entry in file generation command line
IMAGE_DIR: build/arm-none-eabi

steps:
- name: 'Set up Ruby for generation tool'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: 'Install file generation Ruby dependencies'
run: bundle install

- name: 'Run file generation'
run: bash build.sh --dir ${{ env.IMAGE_DIR }} --version dev

- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v3

Expand All @@ -116,28 +212,61 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab-arm-none-eabi
- name: 'Build Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}'
- name: 'Build Docker image ${{ env.IMAGE_NAME }}'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: build/${{ env.VARIANT }}/docker/Dockerfile
build-args: CONTAINER_VERSION=${{ github.ref_name }}
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
context: .
file: ${{ env.IMAGE_DIR }}/docker/Dockerfile
build-args: |
CONTAINER_VERSION=${{ github.ref_name }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_URL }}:latest
# Connect Docker driver to GitHub Action cache service
cache-from: type=gha
cache-to: type=gha,mode=max

# Zip generated files as a single artifact
- name: 'Archive ${{ env.IMAGE_NAME }} generated files as a single artifact'
run: zip -j ${{ env.IMAGE_NAME }}.zip ${{ env.IMAGE_DIR }}/docker/Dockerfile ${{ env.IMAGE_DIR }}/assets/shell/welcome

# Upload the zip artifact
- uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.IMAGE_NAME }}.zip
if-no-files-found: error

madsciencelab-arm-none-eabi-plugins:
runs-on: ubuntu-latest
needs: [image-details]
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
VARIANT: arm-none-eabi-plugins
IMAGE_NAME: ${{ needs.image-details.outputs.base-name }}-arm-none-eabi-plugins
IMAGE_URL: ${{ needs.image-details.outputs.base-url }}-arm-none-eabi-plugins
# Image variant name is drawn from final `--dir` entry in file generation command line
IMAGE_DIR: build/arm-none-eabi-plugins

steps:
- name: 'Set up Ruby for generation tool'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: 'Install file generation Ruby dependencies'
run: bundle install

- name: 'Run file generation'
run: bash build.sh --dir build/arm-none-eabi --dir build/plugins --dir ${{ env.IMAGE_DIR }} --version dev

- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v3

Expand All @@ -152,11 +281,68 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab-arm-none-eabi-plugins
- name: 'Build Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}'
- name: 'Build Docker image ${{ env.IMAGE_NAME }}'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: build/${{ env.VARIANT }}/docker/Dockerfile
build-args: CONTAINER_VERSION=${{ github.ref_name }}
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
context: .
file: ${{ env.IMAGE_DIR }}/docker/Dockerfile
build-args: |
CONTAINER_VERSION=${{ github.ref_name }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_URL }}:latest
# Connect Docker driver to GitHub Action cache service
cache-from: type=gha
cache-to: type=gha,mode=max

# Zip generated files as a single artifact
- name: 'Archive ${{ env.IMAGE_NAME }} generated files as a single artifact'
run: zip -j ${{ env.IMAGE_NAME }}.zip ${{ env.IMAGE_DIR }}/docker/Dockerfile ${{ env.IMAGE_DIR }}/assets/shell/welcome

# Upload the zip artifact
- uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.IMAGE_NAME }}.zip
if-no-files-found: error

# After all Docker image builds, collect results and publish a pre-release
artifacts-dev-build:
runs-on: ubuntu-latest
needs:
- madsciencelab
- madsciencelab-plugins
- madsciencelab-arm-none-eabi
- madsciencelab-arm-none-eabi-plugins
permissions:
contents: write

steps:
# Get the repo so we have info for generating release details
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

# Download all artifacts from the 4 Docker image builds
- uses: actions/download-artifact@v4
with:
# `pattern:` is a workaround to an artifact upload incompatibility with docker/build-push-action@v6
# Otherwise, apart from this bug requiring `pattern:` the default of all artifacts would occur without any intervention
# https://github.com/docker/build-push-action/issues/1167
pattern: "madsciencelab*"
path: artifacts

# Capture the SHA string
- name: 'Git commit short SHA as environment variable'
shell: bash
run: |
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
bodyFile: .github/workflows/release.md
commit: ${{ github.sha }}
tag: ${{ env.SHA_SHORT }}
name: Dev Build ${{ env.SHA_SHORT }}
artifacts: "artifacts/*/*.zip"
37 changes: 37 additions & 0 deletions .github/workflows/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## MadScienceLab Docker Images Builds

Each build produces multiple variants of the `throwtheswitch/madsciencelab` Docker images containing Ceedling and its supporting frameworks as well as various utilities and compilation toolchains. Each image built from this repository targets multiple runtime host platforms.

Build types (via Github Actions):

1. A dev build of this repository generates files and validates the Docker image build.
1. A release build adds to (1) by also pushing the resulting Docker images to Docker Hub.

See the [Docker Hub repository](https://hub.docker.com/r/throwtheswitch) for official releases of the resulting Docker images and their documentation.

## Build Artifacts

* A zip archive for each Docker image containing the generated Dockerfile and any other generated file artifacts used to build the image in Docker Hub.
* A zip archive of the entire project including the static assets used to build the Docker images.

See this reository’s documentation for instructions on how to use the tools of this repository and how to manually build the Docker images this repository maintains.

## Changelog

### Added

* ...

### Fixed

* ...

### Changed

* ...

### Removed

* ...


Loading

0 comments on commit 6f25a00

Please sign in to comment.