Skip to content

Commit fa3c14e

Browse files
Cleanup and working release action. (#17)
* Cleanup and working release action. Using a community GitHub action to get the docker push to ghcr to work. Fancying-up the README * fixing syntax error
1 parent 684d5ab commit fa3c14e

File tree

4 files changed

+72
-29
lines changed

4 files changed

+72
-29
lines changed

.github/workflows/c_cpp.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
name: ghcr.io/opencyphal/c_cpp container build and publish.
22

33
on:
4-
push:
5-
branches: [ "main" ]
4+
release:
5+
types: [ published ]
6+
67
pull_request:
78
branches: [ "main" ]
8-
defaults:
9-
run:
10-
working-directory: ./c_cpp
9+
10+
env:
11+
ORG_NAMESPACE: opencyphal
12+
IMAGE_NAME: c_cpp
13+
LATEST_TAG: ubuntu-20.04
1114

1215
jobs:
1316

14-
build:
17+
build_and_publish:
1518

1619
runs-on: ubuntu-latest
1720

1821
steps:
1922
- uses: actions/checkout@v3
2023

21-
- name: pull
22-
run: docker pull ghcr.io/opencyphal/c_cpp:ubuntu-20.04
23-
- name: build
24-
run: docker build . --tag ghcr.io/opencyphal/c_cpp:ubuntu-20.04
25-
- name: push
26-
if: ${{ github.event_name != 'pull_request' }}
27-
run: docker push ghcr.io/opencyphal/c_cpp:ubuntu-20.04
24+
- name: dryrun-build
25+
if: ${{ github.event_name == 'pull_request' }}
26+
run: docker build ./c_cpp
27+
- name: build-and-push
28+
if: ${{ github.event_name == 'release' && contains(github.ref, '20.04-c_cpp') }}
29+
uses: macbre/push-to-ghcr@master
30+
with:
31+
context: ./${{ env.IMAGE_NAME }}
32+
dockerfile: ./${{ env.IMAGE_NAME }}/Dockerfile
33+
image_name: ${{ env.ORG_NAMESPACE }}/${{ env.IMAGE_NAME }}
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
image_tag: ${{ env.LATEST_TAG }}
36+
repository: ghcr.io

README.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,45 @@
11
![OpenCyphal](opencyphal_logo.svg) OpenCyphal Containerized Toolchains
22
===================
33

4-
This repository contains the Dockerfiles, instructions, and some utilities for building containers to be used as common
5-
toolchains for OpenCyphal projects. These containers are published to the
6-
[opencyphal organization on Github](https://github.com/orgs/OpenCyphal/packages) and are used by the build automation
7-
for OpenCyphal projects. You can use these same containers to get consistent build results in your local development
8-
environment.
4+
This repository contains the Dockerfiles, instructions, and some utilities for
5+
building containers to be used as common toolchains and development environments
6+
for OpenCyphal projects. These containers are published to the [opencyphal
7+
organization on Github](https://github.com/orgs/OpenCyphal/packages) and are used
8+
by the build automation for OpenCyphal projects. You can use these same
9+
containers to get consistent build results in your local development environment.
10+
11+
### opencyphal/c_cpp
12+
13+
[![ghcr.io/opencyphal/c_cpp container build and publish.](https://github.com/OpenCyphal/docker_toolchains/actions/workflows/c_cpp.yml/badge.svg)](https://github.com/OpenCyphal/docker_toolchains/actions/workflows/c_cpp.yml)
14+
15+
The [Open Cyphal c_cpp
16+
container](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/c_cpp)
17+
is based on various Ubuntu releases with the container tag being the latest build
18+
of our c_cpp container based on a given release. This container provides the
19+
necessary compilers and utilities to build and run OpenCyphal C or C++ projects
20+
like [libcanard](https://github.com/OpenCyphal/libcanard) and
21+
[Nunavut](https://github.com/OpenCyphal/nunavut).
22+
23+
#### Supported Versions
24+
25+
| tag | Python | Gcc | Clang | Cmake | Other Utilities |
26+
|----------|--------|-----|-------|-------|-------|
27+
| [ubuntu-20.04](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/c_cpp/69896735?tag=ubuntu-20.04) | 3.10 | 9.3.0 | 10.0.0 | 3.16.3 | <ul><li>qemu</li><li>can-utils</li><li>sonar-scanner</li></ul> |
28+
29+
You can use this in your workflow yaml like this:
30+
31+
```none
32+
jobs:
33+
my-job:
34+
runs-on: ubuntu-latest
35+
container: ghcr.io/opencyphal/c_cpp:ubuntu-20.04
36+
```
37+
38+
39+
### opencyphal/texer
40+
41+
[LaTeX](https://www.latex-project.org/) toolchain. Will be migrated to github actions soon, stay tuned!
42+
43+
### opencyphal/toxic
44+
45+
Python toolchain. Will be migrated to github actions soon. Stay tuned!

c_cpp/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#
44
FROM ubuntu:20.04
55

6+
LABEL org.opencontainers.image.description "Provides a consistent build and test environment for development, continuous-integration, and test automation of OpenCyphal C and C++ based projects."
7+
68
VOLUME /repo
79

810
WORKDIR /repo

c_cpp/README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
The `opencyphal/c_cpp` docker image provides a consistent build and test environment
44
for development, continuous-integration, and test automation of C and C++ based projects.
55

6+
## Official Release
7+
8+
To release a new build of this container simply create a [new github release](https://github.com/OpenCyphal/docker_toolchains/releases/new)
9+
that starts with the ubuntu version container you want to release and ends with "-c_cpp". For example `v20.04-c_cpp`
10+
will cause the github workflow to rebuild and push the `opencyphal/c_cpp:ubuntu-20.04` container.
11+
612
## Manual Build and Push
713

814
These instructions are for maintainers with permissions to push to the
@@ -63,14 +69,3 @@ sonar-scanner \
6369
```
6470

6571
A [CMake example on github](https://github.com/SonarSource/sonarcloud_example_cpp-cmake-linux-otherci)
66-
67-
## Github Actions
68-
69-
You can use this in your workflow yaml like this:
70-
71-
```none
72-
jobs:
73-
my-job:
74-
runs-on: ubuntu-latest
75-
container: ghcr.io/opencyphal/c_cpp:ubuntu-20.04
76-
```

0 commit comments

Comments
 (0)