Compare commits

...

26 Commits

Author SHA1 Message Date
38f4460ecc [CI] setup python the traditional way
Some checks failed
Containers / timestamp (push) Successful in 2s
Containers / release-trigger (push) Has been skipped
Containers / tags (push) Successful in 2s
Containers / stable-release-trigger (push) Has been skipped
Containers / dev-generic (push) Failing after 8s
Containers / architectures (push) Successful in 23s
Containers / candidates (push) Has been skipped
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
2023-07-21 16:01:38 +02:00
bad58164a6 [CI] specify minor python version
Some checks failed
Containers / timestamp (push) Successful in 2s
Containers / release-trigger (push) Has been skipped
Containers / architectures (push) Failing after 3s
Containers / stable-release-trigger (push) Has been skipped
Containers / tags (push) Successful in 2s
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
Containers / dev-generic (push) Failing after 8s
Containers / candidates (push) Has been skipped
2023-07-21 15:52:24 +02:00
507dd685bc specify major version of libpython-dev
Some checks failed
Containers / timestamp (push) Successful in 1s
Containers / release-trigger (push) Has been skipped
Containers / tags (push) Successful in 1s
Containers / stable-release-trigger (push) Has been skipped
Containers / dev-generic (push) Failing after 8s
Containers / architectures (push) Failing after 20s
Containers / candidates (push) Has been skipped
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
2023-07-21 15:50:42 +02:00
143e0bbb30 [CI] specify actions/setup-python version
Some checks failed
Containers / timestamp (push) Successful in 1s
Containers / release-trigger (push) Has been skipped
Containers / tags (push) Successful in 1s
Containers / stable-release-trigger (push) Has been skipped
Containers / dev-generic (push) Failing after 8s
Containers / architectures (push) Failing after 21s
Containers / candidates (push) Has been skipped
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
2023-07-21 15:49:14 +02:00
cd66db04b5 [CI] setup python in gitea environment
Some checks failed
Containers / timestamp (push) Successful in 1s
Containers / architectures (push) Failing after 1s
Containers / tags (push) Successful in 1s
Containers / release-trigger (push) Has been skipped
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-release-trigger (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
Containers / dev-generic (push) Failing after 8s
Containers / candidates (push) Has been skipped
2023-07-21 15:46:29 +02:00
39f3c7b513 [CI] separate directories for Gitea and Github Actions 2023-07-21 15:45:54 +02:00
8aff6dffbd don't use specific version of libpython
Some checks failed
Containers / timestamp (push) Successful in 2s
Containers / release-trigger (push) Has been skipped
Containers / tags (push) Successful in 1s
Containers / architectures (push) Failing after 6s
Containers / stable-release-trigger (push) Has been skipped
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
Containers / dev-generic (push) Failing after 9s
Containers / candidates (push) Has been skipped
2023-07-21 15:41:13 +02:00
0c7477b31a [CI] let pip3 break system packages
Some checks failed
Containers / timestamp (push) Successful in 1s
Containers / release-trigger (push) Has been skipped
Containers / architectures (push) Failing after 2s
Containers / stable-release-trigger (push) Has been skipped
Containers / tags (push) Successful in 1s
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
Containers / dev-generic (push) Failing after 7s
Containers / candidates (push) Has been skipped
2023-07-21 15:33:53 +02:00
2090d3d90d [CI] fix gitea login id
Some checks failed
Containers / timestamp (push) Successful in 1s
Containers / architectures (push) Failing after 2s
Containers / release-trigger (push) Has been skipped
Containers / tags (push) Successful in 1s
Containers / stable-release-trigger (push) Has been skipped
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
Containers / dev-generic (push) Failing after 8s
Containers / candidates (push) Has been skipped
2023-07-21 12:20:37 +02:00
6a30314afd [CI] don't try to login without credentials
Some checks failed
Containers / timestamp (push) Successful in 1s
Containers / release-trigger (push) Has been skipped
Containers / architectures (push) Failing after 2s
Containers / stable-release-trigger (push) Has been skipped
Containers / tags (push) Successful in 2s
Containers / releases (push) Has been skipped
Containers / git-tag (push) Has been skipped
Containers / stable-releases (push) Has been skipped
Containers / stable-git-tag (push) Has been skipped
Containers / dev-generic (push) Failing after 9s
Containers / candidates (push) Has been skipped
2023-07-21 10:52:30 +02:00
63dc1ad69c actually use debian:bookworm-slim 2023-07-21 10:49:11 +02:00
bdec352b19 [CI] use pip3 directly 2023-07-21 10:48:50 +02:00
d97848e6aa use debian:bookworm-slim as base image 2023-07-21 10:45:53 +02:00
5521da9356 [CI] add my gitea instatance 2023-07-21 10:44:19 +02:00
Peter Johanson
ff7ef761d0 feat: Move ssh to build package.
* Some builds might need to pull extra west modules/sub-modules over
  SSH, so move that package to the build image.

Fixes: #142
2023-06-05 12:55:32 -06:00
Peter Johanson
76376c9148 feat: Bump to Zephyr SDK 0.15.2. 2022-12-23 02:05:58 -06:00
Peter Johanson
b4cab4d5a9 Merge branch '3.0-branch' into 3.2-branch 2022-11-03 12:00:43 -04:00
Peter Johanson
9b1bbf4a06 refactor: Move to new actions/checkout. 2022-11-03 11:00:05 -05:00
Peter Johanson
aedbb92f63 refactor: Move to $GITHUB_OUTPUT for step outputs. 2022-11-03 11:00:05 -05:00
Peter Johanson
2eba1525f4 Merge branch '3.0-branch' into 3.2-branch
* Bring in Node version bump, deps bumps, etc.
2022-10-28 22:47:05 -04:00
dependabot[bot]
0712f5046d build(deps): bump docker/setup-buildx-action from 1 to 2
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-28 14:22:46 -05:00
Peter Johanson
2f5f1ed561 chore: Bump a ton of deps. 2022-10-28 12:59:24 -05:00
Peter Johanson
0793ce8183 feat: Use skopeo copy to create multi-arch tags.
* Avoid plain `docker tag` to create stable/versioned tags, as this
  creates single architecture image tags, instead of a new manifest list
* Use `skopeo copy` instead for this!
2022-10-27 00:19:17 -05:00
Peter Johanson
64526ce2de feat: Update to new Node 18 LTS version. 2022-10-26 23:30:03 -05:00
Peter Johanson
a3c3bca1c9 fix: Disable git unsafe directory checks.
* git directory safety checks cause issues for CI, so disabling them.
2022-10-18 20:58:45 -05:00
Peter Johanson
2f5fa1a7e9 feat: Move to Zephyr 3.2/SDK 0.15.2
* SDK 0.15 supports a few more target architectures
* SDK was refactored to minimal zip then download toolchains, so refactor to that.
2022-10-18 20:58:45 -05:00
5 changed files with 898 additions and 132 deletions

10
.gitea/dependabot.yml Normal file
View File

@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@@ -0,0 +1,720 @@
name: Containers
env:
zephyr-version: 3.2.0
zephyr-sdk-version: 0.15.2
sha-abbrev-length: 12
no-cache: ${{ secrets.NO_CACHE != null || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
ignore-actions-cache: ${{ secrets.IGNORE_ACTIONS_CACHE != null }}
run-unit-tests: ${{ secrets.RUN_UNIT_TESTS != null }}
docker-hub-credentials: ${{ secrets.DOCKER_HUB_USERNAME != null && secrets.DOCKER_HUB_TOKEN != null }}
ghcr-credentials: ${{ secrets.GHCR_USERNAME != null && secrets.GHCR_TOKEN != null }}
gitea-credentials: ${{ secrets.GITEA_USERNAME != null && secrets.GITEA_TOKEN != null }}
docker-hub-namespace: ${{ secrets.DOCKER_HUB_NAMESPACE || github.repository_owner }}
docker-hub-namespace-upstream: ${{ secrets.DOCKER_HUB_NAMESPACE_UPSTREAM || 'zmkfirmware' }}
ghcr-namespace: ${{ github.repository_owner }}
zmk-repository: ${{ secrets.ZMK_REPOSITORY || 'zmkfirmware/zmk' }}
zmk-ref: ${{ secrets.ZMK_REF || 'main' }}
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # every day at 02:00 UTC
concurrency: ${{ github.ref }}/${{ github.workflow }}
jobs:
timestamp:
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.timestamp.outputs.timestamp }}
steps:
- name: Timestamp
id: timestamp
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
architectures:
runs-on: ubuntu-latest
outputs:
json: ${{ steps.import.outputs.json }}
steps:
- name: Setup python
run: |
apt-get update
apt-get install --yes --no-install-recommends \
python3 python3-pip
- name: Install yaml2json
run: |
pip3 install remarshal
- name: Checkout
uses: actions/checkout@v3
- name: Import from architectures.yml
id: import
run: echo "json=$(yaml2json architectures.yml | jq -c .)" >> $GITHUB_OUTPUT
tags:
needs:
- timestamp
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.definitions.outputs.branch }}
base: ${{ steps.definitions.outputs.base }}
candidate: ${{ steps.definitions.outputs.candidate }}
versions: ${{ steps.definitions.outputs.versions }} # e.g. 2.4.0-0.11.4
major-minor: ${{ steps.definitions.outputs.major-minor }} # e.g. 2.4
major-minor-branch: ${{ steps.definitions.outputs.major-minor-branch }} # e.g. 2.4-branch
steps:
- name: Definitions
id: definitions
env:
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
SHA: ${{ github.sha }}
SHA_ABBREV_LENGTH: ${{ env.sha-abbrev-length }}
RUN_ID: ${{ github.run_id }}
ZEPHYR_VERSION: ${{ env.zephyr-version }}
ZEPHYR_SDK_VERSION: ${{ env.zephyr-sdk-version }}
run: |
BRANCH=${GITHUB_REF#refs/heads/}
BRANCH=${BRANCH//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
BASE=${GITHUB_BASE_REF//[^A-Za-z0-9_.-]/_} # Substitutes invalid Docker tag characters
SHA=${SHA:0:${SHA_ABBREV_LENGTH}}
CANDIDATE=${BRANCH}-${TIMESTAMP}-${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}-${SHA}-${RUN_ID}
VERSIONS=${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}
MAJOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 1)
MINOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 2)
MAJOR_MINOR=${MAJOR}.${MINOR}
MAJOR_MINOR_BRANCH=${MAJOR_MINOR}-branch
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
echo "base=${BASE}" >> $GITHUB_OUTPUT
echo "candidate=${CANDIDATE}" >> $GITHUB_OUTPUT
echo "versions=${VERSIONS}" >> $GITHUB_OUTPUT
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
echo "major-minor-branch=${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
dev-generic:
needs:
- timestamp
- tags
if: ${{ !startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
id: docker-hub-login
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
id: ghcr-login
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Define paths
id: paths
env:
NS: ${{ env.docker-hub-namespace }}
NSU: ${{ env.docker-hub-namespace-upstream }}
REPOSITORY: zmk-dev-generic
BRANCH: ${{ needs.tags.outputs.branch }}
BASE: ${{ needs.tags.outputs.base }}
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
run: |
echo "local=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
echo "local-new=/tmp/.buildx/dev-generic-new" >> $GITHUB_OUTPUT
echo "branch=docker.io/${NS}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
if [ ! -z "$BASE" ]; then
echo "base=docker.io/${NS}/${REPOSITORY}:${BASE}" >> $GITHUB_OUTPUT
fi
echo "major-minor-branch=docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "branch-upstream=docker.io/${NSU}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
echo "major-minor-branch-upstream=docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
- name: Set up cache
id: cache
uses: actions/cache@v3
env:
cache-name: dev-generic
with:
path: ${{ steps.paths.outputs.local }}
key: ${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}/${{ needs.timestamp.outputs.timestamp }}
restore-keys: |
${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build to local cache
uses: docker/build-push-action@v3
with:
target: dev-generic
platforms: linux/amd64,linux/arm64
build-args: |
ZEPHYR_VERSION=${{ env.zephyr-version }}
no-cache: ${{ env.no-cache == 'true' }}
cache-from: |
${{ (env.ignore-actions-cache == 'false') && format('type=local,src={0}', steps.paths.outputs.local) || '' }}
type=registry,ref=${{ steps.paths.outputs.branch }}
${{ (steps.paths.outputs.base != '') && format('type=registry,ref={0}', steps.paths.outputs.base) || '' }}
type=registry,ref=${{ steps.paths.outputs.major-minor-branch }}
type=registry,ref=${{ steps.paths.outputs.branch-upstream }}
type=registry,ref=${{ steps.paths.outputs.major-minor-branch-upstream }}
cache-to: type=local,dest=${{ steps.paths.outputs.local-new }},mode=max
- name: Push to registry cache
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/build-push-action@v3
with:
target: dev-generic
platforms: linux/amd64,linux/arm64
build-args: |
ZEPHYR_VERSION=${{ env.zephyr-version }}
tags: |
${{ steps.paths.outputs.branch }}
cache-from: type=local,src=${{ steps.paths.outputs.local-new }}
cache-to: type=inline
push: true
# Workaround to stop the dev-generic cache ballooning ...
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Switch local cache
run: |
rm -rf ${{ steps.paths.outputs.local }}
mv ${{ steps.paths.outputs.local-new }} ${{ steps.paths.outputs.local }}
candidates:
needs:
- timestamp
- architectures
- tags
- dev-generic
if: ${{ !startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
env:
docker-args: --rm --workdir /github/workspace -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/_temp:/home/runner/work/_temp -v /home/runner/work/_temp/_github_home:/github/home -v /home/runner/work/_temp/_github_workflow:/github/workflow -v /home/runner/work/_temp/_runner_file_commands:/github/file_commands -v ${{ github.workspace }}:/github/workspace
defaults:
run:
shell: /usr/bin/docker exec candidate /bin/bash {0}
strategy:
fail-fast: false
matrix:
architecture: ${{ fromJSON(needs.architectures.outputs.json) }}
include:
- architecture: arm
board: nice_nano
shield: qaz
steps:
- name: Login to Docker Hub
id: docker-hub-login
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
id: ghcr-login
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Define repositories
id: repositories
shell: bash
run: |
echo "build=zmk-build-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
echo "dev=zmk-dev-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
- name: Define paths
id: paths
shell: bash
env:
NS: ${{ env.docker-hub-namespace }}
NSU: ${{ env.docker-hub-namespace-upstream }}
BUILD: ${{ steps.repositories.outputs.build }}
DEV: ${{ steps.repositories.outputs.dev }}
CANDIDATE: ${{ needs.tags.outputs.candidate }}
BRANCH: ${{ needs.tags.outputs.branch }}
BASE: ${{ needs.tags.outputs.base }}
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
run: |
echo "dev-generic=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
echo "build-candidate=docker.io/${NS}/${BUILD}:${CANDIDATE}" >> $GITHUB_OUTPUT
echo "build-branch=docker.io/${NS}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
if [ ! -z "$BASE" ]; then
echo "build-base=docker.io/${NS}/${BUILD}:${BASE}" >> $GITHUB_OUTPUT
fi
echo "build-major-minor-branch=docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "build-branch-upstream=docker.io/${NSU}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
echo "build-major-minor-branch-upstream=docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "dev-candidate=docker.io/${NS}/${DEV}:${CANDIDATE}" >> $GITHUB_OUTPUT
echo "dev-branch=docker.io/${NS}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
if [ ! -z "$BASE" ]; then
echo "dev-base=docker.io/${NS}/${DEV}:${BASE}" >> $GITHUB_OUTPUT
fi
echo "dev-major-minor-branch=docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "dev-branch-upstream=docker.io/${NSU}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
echo "dev-major-minor-branch-upstream=docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
- name: Define build-args
id: build-args
shell: bash
run: |
LIST="
ZEPHYR_VERSION=${{ env.zephyr-version }}
ARCHITECTURE=${{ matrix.architecture }}
ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }}
"
delimiter="$(openssl rand -hex 8)"
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
echo "${LIST}" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
- name: Define labels
id: labels
shell: bash
run: |
LIST="
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
"
delimiter="$(openssl rand -hex 8)"
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
echo "${LIST}" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
- name: Set up dev-generic cache
id: dev-generic-cache
uses: actions/cache@v3
env:
cache-name: dev-generic
with:
path: ${{ steps.paths.outputs.dev-generic }}
key: ${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}/${{ needs.timestamp.outputs.timestamp }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and load 'build' candidate image
uses: docker/build-push-action@v3
with:
target: build
build-args: |
${{ steps.build-args.outputs.list }}
labels: |
${{ steps.labels.outputs.list }}
tags: |
${{ steps.paths.outputs.build-candidate }}
${{ steps.paths.outputs.build-branch }}
cache-from: |
type=local,src=${{ steps.paths.outputs.dev-generic }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-candidate) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch) }}
${{ (env.no-cache == 'false') && (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch-upstream) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch-upstream) }}
cache-to: type=inline
load: true
- name: Build and load 'dev' candidate image
uses: docker/build-push-action@v3
with:
target: dev
build-args: |
${{ steps.build-args.outputs.list }}
labels: |
${{ steps.labels.outputs.list }}
tags: |
${{ steps.paths.outputs.dev-candidate }}
${{ steps.paths.outputs.dev-branch }}
cache-from: |
type=registry,ref=${{ steps.paths.outputs.build-candidate }}
type=local,src=${{ steps.paths.outputs.dev-generic }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-candidate) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch) }}
${{ (env.no-cache == 'false') && (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch-upstream) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch-upstream) }}
cache-to: type=inline
load: true
- name: Checkout ZMK
uses: actions/checkout@v3
with:
repository: ${{ env.zmk-repository }}
ref: ${{ env.zmk-ref }}
- name: Cache Zephyr modules
uses: actions/cache@v3
env:
cache-name: zephyr-modules
with:
path: |
modules/
tools/
zephyr/
bootloader/
key: ${{ runner.os }}/${{ env.cache-name }}/${{ hashFiles('app/west.yml') }}
restore-keys: |
${{ runner.os }}/${{ env.cache-name }}/
- name: Create and run container from 'build' candidate image
shell: bash
run: docker run -d -it --name candidate ${{ env.docker-args }} ${{ steps.paths.outputs.build-candidate }}
- name: Fixes for git safety checks
run: git config --global --add safe.directory '*'
- name: Test cmake
run: cmake --version
- name: Test python
run: python3 --version
- name: Test diff
run: diff --version
- name: Test west init
run: west init -l app
- name: Test west update
run: west update
- name: Test west zephyr-export
run: west zephyr-export
- name: Test board/shield (west build)
id: board-shield
if: ${{ matrix.board != null }}
run: west build -s app -b ${{ matrix.board }} -- ${{ matrix.shield != null && format('-DSHIELD={0}', matrix.shield) || null }}
- name: Test RAM report (west build)
if: ${{ steps.board-shield.outcome == 'success' }}
run: west build -t ram_report
- name: Test ROM report (west build)
if: ${{ steps.board-shield.outcome == 'success' }}
run: west build -t rom_report
- name: Test west test (single)
run: west test tests/none/normal
- name: Test west test (full)
if: ${{ env.run-unit-tests == 'true' }}
run: west test
- name: Test clean (west build)
if: ${{ steps.board-shield.outcome == 'success' }}
run: west build -t clean
- name: Stop container
shell: bash
run: docker stop candidate
- name: Create and run container from 'dev' candidate image
shell: bash
run: docker run -d -it --name candidate ${{ env.docker-args }} ${{ steps.paths.outputs.dev-candidate }}
- name: Test clang-format
run: clang-format --version
- name: Test node
run: node --version
- name: Test docs ci
run: cd docs && npm ci
- name: Test docs lint
run: cd docs && npm run lint
- name: Test docs prettier check
run: cd docs && npm run prettier:check
- name: Test docs start (webpack-dev-server)
run: cd docs && timeout -s SIGINT 60 npm run start &
- run: sleep 15
- name: Test docs wget (webpack-dev-server)
run: wget http://localhost:3000
- run: sleep 10
- name: Test docs build (webpack)
run: cd docs && npm run build
- name: Test docs serve (webpack)
run: cd docs && timeout -s SIGINT 10 npm run serve &
- run: sleep 5
- name: Test docs wget (webpack)
run: wget http://localhost:3000
- name: Test less
run: less --version
- name: Test PAGER
run: pager --version && [[ $PAGER = "less" ]] && true || false
- name: Test ssh
run: ssh -V
- name: Test gdb
run: gdb --version
- name: Test arm-zephyr-eabi-gdb
if: ${{ matrix.architecture == 'arm' }}
run: /opt/zephyr-sdk-${ZEPHYR_SDK_VERSION}/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb --version
- name: Test tio
run: tio --version
- name: Test socat
run: socat -V
- name: Stop container
shell: bash
run: docker stop candidate
- name: Build and push 'build' candidate image (x86_64 and arm64)
if: ${{ steps.docker-hub-login.outcome == 'success' }}
uses: docker/build-push-action@v3
with:
target: build
platforms: linux/amd64,linux/arm64
build-args: |
${{ steps.build-args.outputs.list }}
labels: |
${{ steps.labels.outputs.list }}
tags: |
${{ steps.paths.outputs.build-candidate }}
${{ steps.paths.outputs.build-branch }}
cache-from: |
type=local,src=${{ steps.paths.outputs.dev-generic }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-candidate) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch) }}
${{ (env.no-cache == 'false') && (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-branch-upstream) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.build-major-minor-branch-upstream) }}
cache-to: type=inline
push: true
- name: Build and push 'dev' candidate image (x86_64 + arm64)
if: ${{ steps.docker-hub-login.outcome == 'success' }}
uses: docker/build-push-action@v3
with:
target: dev
platforms: linux/amd64,linux/arm64
build-args: |
${{ steps.build-args.outputs.list }}
labels: |
${{ steps.labels.outputs.list }}
tags: |
${{ steps.paths.outputs.dev-candidate }}
${{ steps.paths.outputs.dev-branch }}
cache-from: |
type=registry,ref=${{ steps.paths.outputs.build-candidate }}
type=local,src=${{ steps.paths.outputs.dev-generic }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-candidate) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch) }}
${{ (env.no-cache == 'false') && (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-branch-upstream) }}
${{ (env.no-cache == 'false') && format('type=registry,ref={0}', steps.paths.outputs.dev-major-minor-branch-upstream) }}
cache-to: type=inline
push: true
release-trigger:
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.match.outputs.tag }}
branch: ${{ steps.match.outputs.branch }}
datetime: ${{ steps.match.outputs.datetime }}
date: ${{ steps.match.outputs.date }}
year: ${{ steps.match.outputs.year }}
month: ${{ steps.match.outputs.month }}
day: ${{ steps.match.outputs.day }}
time: ${{ steps.match.outputs.time }}
hour: ${{ steps.match.outputs.hour }}
minute: ${{ steps.match.outputs.minute }}
second: ${{ steps.match.outputs.second }}
zephyr-version: ${{ steps.match.outputs.zephyr-version }}
zephyr-version-major: ${{ steps.match.outputs.zephyr-version-major }}
zephyr-version-minor: ${{ steps.match.outputs.zephyr-version-minor }}
zephyr-version-patch: ${{ steps.match.outputs.zephyr-version-patch }}
zephyr-sdk-version: ${{ steps.match.outputs.zephyr-sdk-version }}
zephyr-sdk-version-major: ${{ steps.match.outputs.zephyr-sdk-version-major }}
zephyr-sdk-version-minor: ${{ steps.match.outputs.zephyr-sdk-version-minor }}
zephyr-sdk-version-patch: ${{ steps.match.outputs.zephyr-sdk-version-patch }}
sha: ${{ steps.match.outputs.sha }}
run-id: ${{ steps.match.outputs.run-id }}
steps:
- name: Is tag a release trigger?
id: match
run: |
TAG=${GITHUB_REF#refs/tags/}
PATTERN="^(.+?)-((([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))(([01]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])))-(([0-9]+)\.([0-9]+)\.([0-9]+))-(([0-9]+)\.([0-9]+)\.([0-9]+))-([0-9a-fA-F]+)-([0-9]+)$"
if [[ "${TAG}" =~ $PATTERN ]]; then
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "branch=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "datetime=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo "date=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
echo "year=${BASH_REMATCH[4]}" >> $GITHUB_OUTPUT
echo "month=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
echo "day=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
echo "time=${BASH_REMATCH[7]}" >> $GITHUB_OUTPUT
echo "hour=${BASH_REMATCH[8]}" >> $GITHUB_OUTPUT
echo "minute=${BASH_REMATCH[9]}" >> $GITHUB_OUTPUT
echo "second=${BASH_REMATCH[10]}" >> $GITHUB_OUTPUT
echo "zephyr-version=${BASH_REMATCH[11]}" >> $GITHUB_OUTPUT
echo "zephyr-version-major=${BASH_REMATCH[12]}" >> $GITHUB_OUTPUT
echo "zephyr-version-minor=${BASH_REMATCH[13]}" >> $GITHUB_OUTPUT
echo "zephyr-version-patch=${BASH_REMATCH[14]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version=${BASH_REMATCH[15]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version-major=${BASH_REMATCH[16]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version-minor=${BASH_REMATCH[17]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version-patch=${BASH_REMATCH[18]}" >> $GITHUB_OUTPUT
SHA=${BASH_REMATCH[19]}
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "run-id=${BASH_REMATCH[20]}" >> $GITHUB_OUTPUT
if [[ "${{ github.sha }}" != ${SHA}* ]]; then
echo "Hashes do not match!"
echo "${{ github.sha }}"
echo "${SHA}"
exit 1
fi
else
echo "Tag not recognised, ignoring ..."
fi
releases:
needs:
- architectures
- tags
- release-trigger
if: ${{ needs.release-trigger.outputs.sha != null }}
runs-on: ubuntu-latest
strategy:
matrix:
architecture: ${{ fromJSON(needs.architectures.outputs.json) }}
target:
- build
- dev
steps:
- name: Install skopeo
run: sudo apt-get install -y skopeo
- name: Login to GitHub Container Registry
id: ghcr-login
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub
id: docker-hub-login
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Release (pull candidate, tag, push)
env:
DHNS: ${{ env.docker-hub-namespace }}
GHCRNS: ${{ env.ghcr-namespace }}
TARGET: ${{ matrix.target }}
ARCHITECTURE: ${{ matrix.architecture }}
CANDIDATE: ${{ needs.release-trigger.outputs.tag }}
VERSIONS: ${{ needs.tags.outputs.versions }}
MAJOR_MINOR: ${{ needs.tags.outputs.major-minor }}
run: |
REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:${MAJOR_MINOR}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${MAJOR_MINOR}
git-tag:
needs:
- tags
- releases
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Tag
env:
TAG: ${{ needs.tags.outputs.major-minor }}
run: |
git tag ${TAG}
git push -f origin ${TAG}
stable-release-trigger:
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.match.outputs.tag }}
stable-tag: ${{ steps.match.outputs.stable-tag }}
steps:
- name: Is tag a release trigger?
id: match
run: |
TAG=${GITHUB_REF#refs/tags/}
PATTERN="^(.+?)-stable$"
if [[ "${TAG}" =~ $PATTERN ]]; then
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "stable-tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo "Tag not recognised, ignoring ..."
fi
stable-releases:
needs:
- architectures
- tags
- stable-release-trigger
if: ${{ needs.stable-release-trigger.outputs.stable-tag != null }}
runs-on: ubuntu-latest
strategy:
matrix:
architecture: ${{ fromJSON(needs.architectures.outputs.json) }}
target:
- build
- dev
steps:
- name: Install skopeo
run: sudo apt-get install -y skopeo
- name: Login to GitHub Container Registry
id: ghcr-login
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub
id: docker-hub-login
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Release (pull candidate, tag, push)
env:
DHNS: ${{ env.docker-hub-namespace }}
GHCRNS: ${{ env.ghcr-namespace }}
TARGET: ${{ matrix.target }}
ARCHITECTURE: ${{ matrix.architecture }}
CANDIDATE: ${{ needs.stable-release-trigger.outputs.stable-tag }}
run: |
REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:stable
stable-git-tag:
needs:
- tags
- stable-releases
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ needs.stable-release-trigger.outputs.stable-tag }}
- name: Tag
env:
TAG: ${{ needs.tags.outputs.major-minor }}
run: |
git tag stable
git push -f origin stable

View File

@@ -1,14 +1,15 @@
name: Containers
env:
zephyr-version: 3.0.0
zephyr-sdk-version: 0.13.2
zephyr-version: 3.2.0
zephyr-sdk-version: 0.15.2
sha-abbrev-length: 12
no-cache: ${{ secrets.NO_CACHE != null || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
ignore-actions-cache: ${{ secrets.IGNORE_ACTIONS_CACHE != null }}
run-unit-tests: ${{ secrets.RUN_UNIT_TESTS != null }}
docker-hub-credentials: ${{ secrets.DOCKER_HUB_USERNAME != null && secrets.DOCKER_HUB_TOKEN != null }}
ghcr-credentials: ${{ secrets.GHCR_USERNAME != null && secrets.GHCR_TOKEN != null }}
gitea-credentials: ${{ secrets.GITEA_USERNAME != null && secrets.GITEA_TOKEN != null }}
docker-hub-namespace: ${{ secrets.DOCKER_HUB_NAMESPACE || github.repository_owner }}
docker-hub-namespace-upstream: ${{ secrets.DOCKER_HUB_NAMESPACE_UPSTREAM || 'zmkfirmware' }}
ghcr-namespace: ${{ github.repository_owner }}
@@ -32,22 +33,19 @@ jobs:
steps:
- name: Timestamp
id: timestamp
run: echo ::set-output name=timestamp::$(date +%Y%m%d%H%M%S)
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
architectures:
runs-on: ubuntu-latest
outputs:
json: ${{ steps.import.outputs.json }}
steps:
- name: Install yaml2json
run: pip3 install remarshal
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Import from architectures.yml
id: import
shell: python
run: |
import yaml, json
with open('architectures.yml', 'r') as file:
architectures = yaml.safe_load(file)
print('::set-output name=json::' + json.dumps(architectures))
run: echo "json=$(yaml2json architectures.yml | jq -c .)" >> $GITHUB_OUTPUT
tags:
needs:
- timestamp
@@ -81,12 +79,12 @@ jobs:
MAJOR_MINOR=${MAJOR}.${MINOR}
MAJOR_MINOR_BRANCH=${MAJOR_MINOR}-branch
echo ::set-output name=branch::${BRANCH}
echo ::set-output name=base::${BASE}
echo ::set-output name=candidate::${CANDIDATE}
echo ::set-output name=versions::${VERSIONS}
echo ::set-output name=major-minor::${MAJOR_MINOR}
echo ::set-output name=major-minor-branch::${MAJOR_MINOR_BRANCH}
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
echo "base=${BASE}" >> $GITHUB_OUTPUT
echo "candidate=${CANDIDATE}" >> $GITHUB_OUTPUT
echo "versions=${VERSIONS}" >> $GITHUB_OUTPUT
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
echo "major-minor-branch=${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
dev-generic:
needs:
- timestamp
@@ -97,18 +95,26 @@ jobs:
- name: Login to Docker Hub
id: docker-hub-login
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
id: ghcr-login
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Define paths
id: paths
env:
@@ -119,18 +125,18 @@ jobs:
BASE: ${{ needs.tags.outputs.base }}
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
run: |
echo ::set-output name=local::/tmp/.buildx/dev-generic
echo ::set-output name=local-new::/tmp/.buildx/dev-generic-new
echo ::set-output name=branch::docker.io/${NS}/${REPOSITORY}:${BRANCH}
echo "local=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
echo "local-new=/tmp/.buildx/dev-generic-new" >> $GITHUB_OUTPUT
echo "branch=docker.io/${NS}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
if [ ! -z "$BASE" ]; then
echo ::set-output name=base::docker.io/${NS}/${REPOSITORY}:${BASE}
echo "base=docker.io/${NS}/${REPOSITORY}:${BASE}" >> $GITHUB_OUTPUT
fi
echo ::set-output name=major-minor-branch::docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}
echo ::set-output name=branch-upstream::docker.io/${NSU}/${REPOSITORY}:${BRANCH}
echo ::set-output name=major-minor-branch-upstream::docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}
echo "major-minor-branch=docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "branch-upstream=docker.io/${NSU}/${REPOSITORY}:${BRANCH}" >> $GITHUB_OUTPUT
echo "major-minor-branch-upstream=docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
- name: Set up cache
id: cache
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: dev-generic
with:
@@ -139,11 +145,11 @@ jobs:
restore-keys: |
${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Build to local cache
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
target: dev-generic
platforms: linux/amd64,linux/arm64
@@ -160,7 +166,7 @@ jobs:
cache-to: type=local,dest=${{ steps.paths.outputs.local-new }},mode=max
- name: Push to registry cache
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
target: dev-generic
platforms: linux/amd64,linux/arm64
@@ -203,24 +209,32 @@ jobs:
- name: Login to Docker Hub
id: docker-hub-login
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
id: ghcr-login
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Define repositories
id: repositories
shell: bash
run: |
echo ::set-output name=build::zmk-build-${{ matrix.architecture }}
echo ::set-output name=dev::zmk-dev-${{ matrix.architecture }}
echo "build=zmk-build-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
echo "dev=zmk-dev-${{ matrix.architecture }}" >> $GITHUB_OUTPUT
- name: Define paths
id: paths
shell: bash
@@ -234,23 +248,23 @@ jobs:
BASE: ${{ needs.tags.outputs.base }}
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
run: |
echo ::set-output name=dev-generic::/tmp/.buildx/dev-generic
echo ::set-output name=build-candidate::docker.io/${NS}/${BUILD}:${CANDIDATE}
echo ::set-output name=build-branch::docker.io/${NS}/${BUILD}:${BRANCH}
echo "dev-generic=/tmp/.buildx/dev-generic" >> $GITHUB_OUTPUT
echo "build-candidate=docker.io/${NS}/${BUILD}:${CANDIDATE}" >> $GITHUB_OUTPUT
echo "build-branch=docker.io/${NS}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
if [ ! -z "$BASE" ]; then
echo ::set-output name=build-base::docker.io/${NS}/${BUILD}:${BASE}
echo "build-base=docker.io/${NS}/${BUILD}:${BASE}" >> $GITHUB_OUTPUT
fi
echo ::set-output name=build-major-minor-branch::docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}
echo ::set-output name=build-branch-upstream::docker.io/${NSU}/${BUILD}:${BRANCH}
echo ::set-output name=build-major-minor-branch-upstream::docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}
echo ::set-output name=dev-candidate::docker.io/${NS}/${DEV}:${CANDIDATE}
echo ::set-output name=dev-branch::docker.io/${NS}/${DEV}:${BRANCH}
echo "build-major-minor-branch=docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "build-branch-upstream=docker.io/${NSU}/${BUILD}:${BRANCH}" >> $GITHUB_OUTPUT
echo "build-major-minor-branch-upstream=docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "dev-candidate=docker.io/${NS}/${DEV}:${CANDIDATE}" >> $GITHUB_OUTPUT
echo "dev-branch=docker.io/${NS}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
if [ ! -z "$BASE" ]; then
echo ::set-output name=dev-base::docker.io/${NS}/${DEV}:${BASE}
echo "dev-base=docker.io/${NS}/${DEV}:${BASE}" >> $GITHUB_OUTPUT
fi
echo ::set-output name=dev-major-minor-branch::docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}
echo ::set-output name=dev-branch-upstream::docker.io/${NSU}/${DEV}:${BRANCH}
echo ::set-output name=dev-major-minor-branch-upstream::docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}
echo "dev-major-minor-branch=docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
echo "dev-branch-upstream=docker.io/${NSU}/${DEV}:${BRANCH}" >> $GITHUB_OUTPUT
echo "dev-major-minor-branch-upstream=docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}" >> $GITHUB_OUTPUT
- name: Define build-args
id: build-args
shell: bash
@@ -260,12 +274,11 @@ jobs:
ARCHITECTURE=${{ matrix.architecture }}
ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }}
"
# Escapes %, \n and \r
# See: https://github.community/t/set-output-truncates-multiline-strings/16852
LIST="${LIST//'%'/'%25'}"
LIST="${LIST//$'\n'/'%0A'}"
LIST="${LIST//$'\r'/'%0D'}"
echo ::set-output name=list::${LIST}
delimiter="$(openssl rand -hex 8)"
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
echo "${LIST}" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
- name: Define labels
id: labels
shell: bash
@@ -274,26 +287,25 @@ jobs:
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
"
# Escapes %, \n and \r
# See: https://github.community/t/set-output-truncates-multiline-strings/16852
LIST="${LIST//'%'/'%25'}"
LIST="${LIST//$'\n'/'%0A'}"
LIST="${LIST//$'\r'/'%0D'}"
echo ::set-output name=list::${LIST}
delimiter="$(openssl rand -hex 8)"
echo "list<<${delimiter}" >> $GITHUB_OUTPUT
echo "${LIST}" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
- name: Set up dev-generic cache
id: dev-generic-cache
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: dev-generic
with:
path: ${{ steps.paths.outputs.dev-generic }}
key: ${{ runner.os }}/${{ env.cache-name }}/${{ github.run_id }}/${{ needs.timestamp.outputs.timestamp }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Build and load 'build' candidate image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
target: build
build-args: |
@@ -314,7 +326,7 @@ jobs:
cache-to: type=inline
load: true
- name: Build and load 'dev' candidate image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
target: dev
build-args: |
@@ -336,12 +348,12 @@ jobs:
cache-to: type=inline
load: true
- name: Checkout ZMK
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ env.zmk-repository }}
ref: ${{ env.zmk-ref }}
- name: Cache Zephyr modules
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: zephyr-modules
with:
@@ -437,7 +449,7 @@ jobs:
run: docker stop candidate
- name: Build and push 'build' candidate image (x86_64 and arm64)
if: ${{ steps.docker-hub-login.outcome == 'success' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
target: build
platforms: linux/amd64,linux/arm64
@@ -460,7 +472,7 @@ jobs:
push: true
- name: Build and push 'dev' candidate image (x86_64 + arm64)
if: ${{ steps.docker-hub-login.outcome == 'success' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
target: dev
platforms: linux/amd64,linux/arm64
@@ -514,28 +526,28 @@ jobs:
TAG=${GITHUB_REF#refs/tags/}
PATTERN="^(.+?)-((([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))(([01]?[0-9]|2[0-3])([0-5][0-9])([0-5][0-9])))-(([0-9]+)\.([0-9]+)\.([0-9]+))-(([0-9]+)\.([0-9]+)\.([0-9]+))-([0-9a-fA-F]+)-([0-9]+)$"
if [[ "${TAG}" =~ $PATTERN ]]; then
echo ::set-output name=tag::${TAG}
echo ::set-output name=branch::${BASH_REMATCH[1]}
echo ::set-output name=datetime::${BASH_REMATCH[2]}
echo ::set-output name=date::${BASH_REMATCH[3]}
echo ::set-output name=year::${BASH_REMATCH[4]}
echo ::set-output name=month::${BASH_REMATCH[5]}
echo ::set-output name=day::${BASH_REMATCH[6]}
echo ::set-output name=time::${BASH_REMATCH[7]}
echo ::set-output name=hour::${BASH_REMATCH[8]}
echo ::set-output name=minute::${BASH_REMATCH[9]}
echo ::set-output name=second::${BASH_REMATCH[10]}
echo ::set-output name=zephyr-version::${BASH_REMATCH[11]}
echo ::set-output name=zephyr-version-major::${BASH_REMATCH[12]}
echo ::set-output name=zephyr-version-minor::${BASH_REMATCH[13]}
echo ::set-output name=zephyr-version-patch::${BASH_REMATCH[14]}
echo ::set-output name=zephyr-sdk-version::${BASH_REMATCH[15]}
echo ::set-output name=zephyr-sdk-version-major::${BASH_REMATCH[16]}
echo ::set-output name=zephyr-sdk-version-minor::${BASH_REMATCH[17]}
echo ::set-output name=zephyr-sdk-version-patch::${BASH_REMATCH[18]}
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "branch=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "datetime=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo "date=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
echo "year=${BASH_REMATCH[4]}" >> $GITHUB_OUTPUT
echo "month=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
echo "day=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
echo "time=${BASH_REMATCH[7]}" >> $GITHUB_OUTPUT
echo "hour=${BASH_REMATCH[8]}" >> $GITHUB_OUTPUT
echo "minute=${BASH_REMATCH[9]}" >> $GITHUB_OUTPUT
echo "second=${BASH_REMATCH[10]}" >> $GITHUB_OUTPUT
echo "zephyr-version=${BASH_REMATCH[11]}" >> $GITHUB_OUTPUT
echo "zephyr-version-major=${BASH_REMATCH[12]}" >> $GITHUB_OUTPUT
echo "zephyr-version-minor=${BASH_REMATCH[13]}" >> $GITHUB_OUTPUT
echo "zephyr-version-patch=${BASH_REMATCH[14]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version=${BASH_REMATCH[15]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version-major=${BASH_REMATCH[16]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version-minor=${BASH_REMATCH[17]}" >> $GITHUB_OUTPUT
echo "zephyr-sdk-version-patch=${BASH_REMATCH[18]}" >> $GITHUB_OUTPUT
SHA=${BASH_REMATCH[19]}
echo ::set-output name=sha::${SHA}
echo ::set-output name=run-id::${BASH_REMATCH[20]}
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "run-id=${BASH_REMATCH[20]}" >> $GITHUB_OUTPUT
if [[ "${{ github.sha }}" != ${SHA}* ]]; then
echo "Hashes do not match!"
@@ -560,19 +572,31 @@ jobs:
- build
- dev
steps:
- name: Install skopeo
run: sudo apt-get install -y skopeo
- name: Login to GitHub Container Registry
id: ghcr-login
uses: docker/login-action@v1
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub
id: docker-hub-login
uses: docker/login-action@v1
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Release (pull candidate, tag, push)
env:
DHNS: ${{ env.docker-hub-namespace }}
@@ -585,18 +609,11 @@ jobs:
run: |
REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
docker pull docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE}
docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker.io/${DHNS}/${REPOSITORY}:${MAJOR_MINOR}
docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} ghcr.io/${GHCRNS}/${REPOSITORY}:${MAJOR_MINOR}
docker push docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE}
docker push docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
docker push docker.io/${DHNS}/${REPOSITORY}:${MAJOR_MINOR}
docker push ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
docker push ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
docker push ghcr.io/${GHCRNS}/${REPOSITORY}:${MAJOR_MINOR}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:${MAJOR_MINOR}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://ghcr.io/${GHCRNS}/${REPOSITORY}:${MAJOR_MINOR}
git-tag:
needs:
- tags
@@ -604,7 +621,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Tag
env:
TAG: ${{ needs.tags.outputs.major-minor }}
@@ -624,8 +641,8 @@ jobs:
TAG=${GITHUB_REF#refs/tags/}
PATTERN="^(.+?)-stable$"
if [[ "${TAG}" =~ $PATTERN ]]; then
echo ::set-output name=tag::${TAG}
echo ::set-output name=stable-tag::${BASH_REMATCH[1]}
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "stable-tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo "Tag not recognised, ignoring ..."
fi
@@ -643,19 +660,31 @@ jobs:
- build
- dev
steps:
- name: Install skopeo
run: sudo apt-get install -y skopeo
- name: Login to GitHub Container Registry
id: ghcr-login
uses: docker/login-action@v1
if: ${{ env.ghcr-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub
id: docker-hub-login
uses: docker/login-action@v1
if: ${{ env.docker-hub-credentials == 'true' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to Gitea
id: gitea-login
if: ${{ env.gitea-credentials == 'true' }}
uses: docker/login-action@v2
with:
registry: git.sporq.de
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Release (pull candidate, tag, push)
env:
DHNS: ${{ env.docker-hub-namespace }}
@@ -666,10 +695,7 @@ jobs:
run: |
REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
docker pull docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE}
docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker.io/${DHNS}/${REPOSITORY}:stable
docker push docker.io/${DHNS}/${REPOSITORY}:stable
skopeo copy --all docker://docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker://docker.io/${DHNS}/${REPOSITORY}:stable
stable-git-tag:
needs:
- tags
@@ -677,7 +703,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ needs.stable-release-trigger.outputs.stable-tag }}
- name: Tag

View File

@@ -1,4 +1,4 @@
FROM ubuntu:focal-20220113 AS common
FROM debian:bookworm-slim AS common
CMD ["/bin/bash"]
@@ -23,9 +23,10 @@ RUN \
python3-pip \
python3-setuptools \
python3-wheel \
&& pip3 install \
ssh \
&& pip3 install --break-system-packages \
-r https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/v${ZEPHYR_VERSION}/scripts/requirements-base.txt \
&& pip3 install cmake \
&& pip3 install --break-system-packages cmake \
&& apt-get remove -y --purge \
python3-dev \
python3-pip \
@@ -45,7 +46,7 @@ RUN \
apt-get -y update \
&& apt-get -y install --no-install-recommends \
curl \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& curl -sL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get -y update \
&& apt-get -y install --no-install-recommends \
clang-format \
@@ -53,7 +54,7 @@ RUN \
gpg \
gpg-agent \
less \
libpython3.8-dev \
libpython3-dev \
libsdl2-dev \
locales \
nano \
@@ -65,11 +66,10 @@ RUN \
python3-tk \
python3-wheel \
socat \
ssh \
tio \
wget \
xz-utils \
&& pip3 install \
&& pip3 install --break-system-packages \
-r https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/v${ZEPHYR_VERSION}/scripts/requirements-build-test.txt \
-r https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/v${ZEPHYR_VERSION}/scripts/requirements-run-test.txt \
&& apt-get clean \
@@ -88,14 +88,21 @@ ARG ARCHITECTURE
ARG ZEPHYR_SDK_VERSION
ARG ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk-${ZEPHYR_SDK_VERSION}
RUN \
export sdk_file_name="zephyr-toolchain-${ARCHITECTURE}-${ZEPHYR_SDK_VERSION}-linux-$(uname -m)-setup.run" \
export minimal_sdk_file_name="zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-$(uname -m)_minimal" \
&& if [ "${ARCHITECTURE}" = "arm" ]; then arch_format="eabi"; else arch_format="elf"; fi \
&& if [ "${ARCHITECTURE#xtensa}" = "${ARCHITECTURE}" ]; then arch_sep="-"; else arch_sep="_"; fi \
&& apt-get -y update \
&& apt-get -y install --no-install-recommends \
wget \
xz-utils \
&& wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/${sdk_file_name}" \
&& sh ${sdk_file_name} --quiet -- -d ${ZEPHYR_SDK_INSTALL_DIR} \
&& rm ${sdk_file_name} \
&& cd ${TMP} \
&& wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/${minimal_sdk_file_name}.tar.gz" \
&& tar xvfz ${minimal_sdk_file_name}.tar.gz \
&& mv zephyr-sdk-${ZEPHYR_SDK_VERSION} /opt/ \
&& rm ${minimal_sdk_file_name}.tar.gz \
&& cd /opt/zephyr-sdk-${ZEPHYR_SDK_VERSION} \
&& ./setup.sh -h -c -t ${ARCHITECTURE}${arch_sep}zephyr-${arch_format} \
&& cd \
&& apt-get remove -y --purge \
wget \
xz-utils \

View File

@@ -1,15 +1,18 @@
- arc
- arc64
- arm
- arm64
- aarch64
- mips
- nios2
- riscv64
- sparc
- x86_64
- xtensa_intel_apl_adsp
- xtensa_intel_bdw_adsp
- xtensa_intel_byt_adsp
- xtensa_intel_s1000
- xtensa_nxp_imx8m_adsp
- xtensa_nxp_imx_adsp
- xtensa_sample_controller
- xtensa-espressif_esp32
- xtensa-espressif_esp32s2
- xtensa-intel_apl_adsp
- xtensa-intel_bdw_adsp
- xtensa-intel_byt_adsp
- xtensa-intel_s1000
- xtensa-nxp_imx8m_adsp
- xtensa-nxp_imx_adsp
- xtensa-sample_controller