Compare commits
2 Commits
cb75a136dd
...
70a03fa30f
Author | SHA1 | Date | |
---|---|---|---|
70a03fa30f | |||
5ec0b5e18a |
10
.github/dependabot.yml
vendored
10
.github/dependabot.yml
vendored
@ -1,10 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/docs"
|
||||
schedule:
|
||||
interval: "daily"
|
15
.github/pull_request_template.md
vendored
15
.github/pull_request_template.md
vendored
@ -1,15 +0,0 @@
|
||||
<!-- If you're adding a board/shield please fill out this check-list, otherwise you can delete it -->
|
||||
|
||||
## Board/Shield Check-list
|
||||
|
||||
- [ ] This board/shield is tested working on real hardware
|
||||
- [ ] Definitions follow the general style of other shields/boards upstream ([Reference](https://zmk.dev/docs/development/new-shield))
|
||||
- [ ] `.zmk.yml` metadata file added
|
||||
- [ ] Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
|
||||
- [ ] General consistent formatting of DeviceTree files
|
||||
- [ ] Keymaps do not use deprecated key defines (Check using the [upgrader tool](https://zmk.dev/docs/codes/keymap-upgrader))
|
||||
- [ ] `&pro_micro` used in favor of `&pro_micro_d/a` if applicable
|
||||
- [ ] If split, no name added for the right/peripheral half
|
||||
- [ ] Kconfig.defconfig file correctly wraps _all_ configuration in conditional on the shield symbol
|
||||
- [ ] `.conf` file has optional extra features commented out
|
||||
- [ ] Keyboard/PCB is part of a shipped group buy or is generally available in stock to purchase (OSH/personal projects without general availability should create a zmk-config repo instead)
|
78
.github/workflows/ble-test.yml
vendored
78
.github/workflows/ble-test.yml
vendored
@ -1,78 +0,0 @@
|
||||
name: BLE Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/ble-test.yml"
|
||||
- "app/tests/ble/**"
|
||||
- "app/src/**"
|
||||
- "app/run-ble-test.sh"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/ble-test.yml"
|
||||
- "app/tests/ble/**"
|
||||
- "app/src/**"
|
||||
- "app/run-ble-test.sh"
|
||||
|
||||
jobs:
|
||||
collect-tests:
|
||||
outputs:
|
||||
test-dirs: ${{ steps.test-dirs.outputs.test-dirs }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Find test directories
|
||||
id: test-dirs
|
||||
run: |
|
||||
cd app/tests/ble
|
||||
export TESTS=$(ls -d * | grep -v central | jq -R -s -c 'split("\n")[:-1]')
|
||||
echo "test-dirs=${TESTS}" > $GITHUB_OUTPUT
|
||||
run-tests:
|
||||
needs: collect-tests
|
||||
strategy:
|
||||
matrix:
|
||||
test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.io/zmkfirmware/zmk-build-arm:3.5
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Cache west modules
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-zephyr-modules
|
||||
with:
|
||||
path: |
|
||||
modules/
|
||||
tools/
|
||||
zephyr/
|
||||
bootloader/
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: Initialize workspace (west init)
|
||||
run: west init -l app
|
||||
- name: Enable babblesim group filter
|
||||
run: west config manifest.group-filter -- +babblesim
|
||||
- name: Update modules (west update)
|
||||
run: west update
|
||||
- name: Export Zephyr CMake package (west zephyr-export)
|
||||
run: west zephyr-export
|
||||
- name: Build BabbleSim components
|
||||
working-directory: tools/bsim
|
||||
run: make everything
|
||||
- name: Test ${{ matrix.test }}
|
||||
working-directory: app
|
||||
run: BSIM_COMPONENTS_PATH="${GITHUB_WORKSPACE}/tools/bsim/components" BSIM_OUT_PATH="${GITHUB_WORKSPACE}/tools/bsim" ./run-ble-test.sh tests/ble/${{ matrix.test }}
|
||||
- name: Archive artifacts
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "${{ matrix.test }}-log-files"
|
||||
path: app/build/**/*.log
|
182
.github/workflows/build-user-config.yml
vendored
182
.github/workflows/build-user-config.yml
vendored
@ -1,182 +0,0 @@
|
||||
name: Reusable user config build
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build_matrix_path:
|
||||
description: "Path to the build matrix file"
|
||||
default: "build.yaml"
|
||||
required: false
|
||||
type: string
|
||||
config_path:
|
||||
description: "Path to the config directory"
|
||||
default: "config"
|
||||
required: false
|
||||
type: string
|
||||
fallback_binary:
|
||||
description: "Fallback binary format, if no *.uf2 file was built"
|
||||
default: "bin"
|
||||
required: false
|
||||
type: string
|
||||
archive_name:
|
||||
description: "Archive output file name"
|
||||
default: "firmware"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
name: Fetch Build Keyboards
|
||||
outputs:
|
||||
build_matrix: ${{ env.build_matrix }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install yaml2json
|
||||
run: python3 -m pip install remarshal
|
||||
|
||||
- name: Fetch Build Matrix
|
||||
run: |
|
||||
echo "build_matrix=$(yaml2json '${{ inputs.build_matrix_path }}' | jq -c .)" >> $GITHUB_ENV
|
||||
yaml2json "${{ inputs.build_matrix_path }}" | jq
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: zmkfirmware/zmk-build-arm:stable
|
||||
needs: matrix
|
||||
name: Build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create build directory
|
||||
run: |
|
||||
echo "build_dir=$(mktemp -d)" >> $GITHUB_ENV
|
||||
|
||||
- name: Prepare variables
|
||||
shell: sh -x {0}
|
||||
env:
|
||||
board: ${{ matrix.board }}
|
||||
shield: ${{ matrix.shield }}
|
||||
artifact_name: ${{ matrix.artifact-name }}
|
||||
snippet: ${{ matrix.snippet }}
|
||||
run: |
|
||||
if [ -e zephyr/module.yml ]; then
|
||||
export zmk_load_arg=" -DZMK_EXTRA_MODULES='${GITHUB_WORKSPACE}'"
|
||||
new_tmp_dir="${TMPDIR:-/tmp}/zmk-config"
|
||||
mkdir -p "${new_tmp_dir}"
|
||||
echo "base_dir=${new_tmp_dir}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "base_dir=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
if [ -n "${snippet}" ]; then
|
||||
extra_west_args="-S \"${snippet}\""
|
||||
fi
|
||||
|
||||
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
|
||||
echo "extra_west_args=${extra_west_args}" >> $GITHUB_ENV
|
||||
echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}${zmk_load_arg}" >> $GITHUB_ENV
|
||||
echo "display_name=${shield:+$shield - }${board}" >> $GITHUB_ENV
|
||||
echo "artifact_name=${artifact_name:-${shield:+$shield-}${board}-zmk}" >> $GITHUB_ENV
|
||||
|
||||
- name: Copy config files to isolated temporary directory
|
||||
run: |
|
||||
if [ "${{ env.base_dir }}" != "${GITHUB_WORKSPACE}" ]; then
|
||||
mkdir "${{ env.base_dir }}/${{ inputs.config_path }}"
|
||||
cp -R ${{ inputs.config_path }}/* "${{ env.base_dir }}/${{ inputs.config_path }}/"
|
||||
fi
|
||||
|
||||
- name: Cache west modules
|
||||
uses: actions/cache@v4
|
||||
continue-on-error: true
|
||||
env:
|
||||
cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
|
||||
with:
|
||||
path: |
|
||||
${{ env.base_dir }}/modules/
|
||||
${{ env.base_dir }}/tools/
|
||||
${{ env.base_dir }}/zephyr/
|
||||
${{ env.base_dir }}/bootloader/
|
||||
${{ env.base_dir }}/zmk/
|
||||
key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache_name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: West Init
|
||||
working-directory: ${{ env.base_dir }}
|
||||
run: west init -l "${{ env.base_dir }}/${{ inputs.config_path }}"
|
||||
|
||||
- name: West Update
|
||||
working-directory: ${{ env.base_dir }}
|
||||
run: west update
|
||||
|
||||
- name: West Zephyr export
|
||||
working-directory: ${{ env.base_dir }}
|
||||
run: west zephyr-export
|
||||
|
||||
- name: West Build (${{ env.display_name }})
|
||||
working-directory: ${{ env.base_dir }}
|
||||
shell: sh -x {0}
|
||||
run: west build -s zmk/app -d "${{ env.build_dir }}" -b "${{ matrix.board }}" ${{ env.extra_west_args }} -- -DZMK_CONFIG=${{ env.base_dir }}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
|
||||
|
||||
- name: ${{ env.display_name }} Kconfig file
|
||||
run: |
|
||||
if [ -f "${{ env.build_dir }}/zephyr/.config" ]
|
||||
then
|
||||
grep -v -e "^#" -e "^$" "${{ env.build_dir }}/zephyr/.config" | sort
|
||||
else
|
||||
echo "No Kconfig output"
|
||||
fi
|
||||
if: ${{ !cancelled() }}
|
||||
|
||||
- name: ${{ env.display_name }} Devicetree file
|
||||
run: |
|
||||
if [ -f "${{ env.build_dir }}/zephyr/zephyr.dts" ]
|
||||
then
|
||||
cat "${{ env.build_dir }}/zephyr/zephyr.dts"
|
||||
elif [ -f "${{ env.build_dir }}/zephyr/zephyr.dts.pre" ]
|
||||
then
|
||||
cat -s "${{ env.build_dir }}/zephyr/zephyr.dts.pre"
|
||||
else
|
||||
echo "No Devicetree output"
|
||||
fi
|
||||
if: ${{ !cancelled() }}
|
||||
|
||||
- name: Rename artifacts
|
||||
shell: sh -x {0}
|
||||
run: |
|
||||
mkdir "${{ env.build_dir }}/artifacts"
|
||||
if [ -f "${{ env.build_dir }}/zephyr/zmk.uf2" ]
|
||||
then
|
||||
cp "${{ env.build_dir }}/zephyr/zmk.uf2" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.uf2"
|
||||
elif [ -f "${{ env.build_dir }}/zephyr/zmk.${{ inputs.fallback_binary }}" ]
|
||||
then
|
||||
cp "${{ env.build_dir }}/zephyr/zmk.${{ inputs.fallback_binary }}" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
|
||||
fi
|
||||
|
||||
- name: Archive (${{ env.display_name }})
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifact-${{ env.artifact_name }}
|
||||
path: ${{ env.build_dir }}/artifacts
|
||||
|
||||
merge:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
name: Merge Output Artifacts
|
||||
steps:
|
||||
- name: Merge Artifacts
|
||||
uses: actions/upload-artifact/merge@v4
|
||||
with:
|
||||
name: ${{ inputs.archive_name }}
|
||||
pattern: artifact-*
|
||||
delete-merged: true
|
438
.github/workflows/build.yml
vendored
438
.github/workflows/build.yml
vendored
@ -1,438 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/build.yml"
|
||||
- "app/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/build.yml"
|
||||
- "app/**"
|
||||
schedule:
|
||||
- cron: "22 4 * * *"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ always() }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.io/zmkfirmware/zmk-build-arm:3.5
|
||||
needs: compile-matrix
|
||||
strategy:
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.compile-matrix.outputs.include-list) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Cache west modules
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-zephyr-modules
|
||||
with:
|
||||
path: |
|
||||
modules/
|
||||
tools/
|
||||
zephyr/
|
||||
bootloader/
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: Initialize workspace (west init)
|
||||
run: west init -l app
|
||||
- name: Update modules (west update)
|
||||
run: west update
|
||||
- name: Export Zephyr CMake package (west zephyr-export)
|
||||
run: west zephyr-export
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "14.x"
|
||||
- name: Install @actions/artifact
|
||||
run: npm install @actions/artifact
|
||||
- name: Build
|
||||
uses: actions/github-script@v7
|
||||
id: boards-list
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
const buildShieldArgs = JSON.parse(`${{ matrix.shieldArgs }}`);
|
||||
|
||||
let error = false;
|
||||
|
||||
for (const shieldArgs of buildShieldArgs) {
|
||||
try {
|
||||
console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Build`)
|
||||
|
||||
const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD="' + shieldArgs.shield + '"' : ''} ${shieldArgs['cmake-args'] || ''}`);
|
||||
|
||||
console.log(output.toString());
|
||||
} catch (e) {
|
||||
console.error(`::error::Failed to build ${{ matrix.board }} ${shieldArgs.shield} ${shieldArgs['cmake-args']}`);
|
||||
console.error(e);
|
||||
error = true;
|
||||
} finally {
|
||||
console.log('::endgroup::');
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
throw new Error('Failed to build one or more configurations');
|
||||
}
|
||||
- name: Upload artifacts
|
||||
uses: actions/github-script@v7
|
||||
continue-on-error: ${{ github.event_name == 'pull_request' }}
|
||||
id: boards-upload
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const {default: artifact} = require('@actions/artifact');
|
||||
|
||||
const buildShieldArgs = JSON.parse(`${{ matrix.shieldArgs }}`);
|
||||
|
||||
let error = false;
|
||||
|
||||
for (const shieldArgs of buildShieldArgs) {
|
||||
try {
|
||||
console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Upload`)
|
||||
|
||||
const fileExtensions = ["hex", "uf2"];
|
||||
|
||||
const files = fileExtensions
|
||||
.map(extension => "build/zephyr/zmk." + extension)
|
||||
.filter(path => fs.existsSync(path));
|
||||
|
||||
const rootDirectory = 'build/zephyr';
|
||||
const options = {
|
||||
continueOnError: true
|
||||
}
|
||||
|
||||
const cmakeName = shieldArgs['cmake-args'] ? '-' + (shieldArgs.nickname || shieldArgs['cmake-args'].split(' ').join('')) : '';
|
||||
const artifactName = `${{ matrix.board }}${shieldArgs.shield ? '-' + shieldArgs.shield : ''}${cmakeName}-zmk`;
|
||||
|
||||
await artifact.uploadArtifact(artifactName, files, rootDirectory, options);
|
||||
} catch (e) {
|
||||
console.error(`::error::Failed to upload ${{ matrix.board }} ${shieldArgs.shield} ${shieldArgs['cmake-args']}`);
|
||||
console.error(e);
|
||||
error = true;
|
||||
} finally {
|
||||
console.log('::endgroup::');
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
throw new Error('Failed to build one or more configurations');
|
||||
}
|
||||
compile-matrix:
|
||||
if: ${{ always() }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [core-coverage, board-changes, nightly]
|
||||
outputs:
|
||||
include-list: ${{ steps.compile-list.outputs.result }}
|
||||
steps:
|
||||
- name: Join build lists
|
||||
uses: actions/github-script@v7
|
||||
id: compile-list
|
||||
with:
|
||||
script: |
|
||||
const coreCoverage = `${{ needs.core-coverage.outputs.core-include }}` || "[]";
|
||||
const boardChanges = `${{ needs.board-changes.outputs.boards-include }}` || "[]";
|
||||
const nightly = `${{ needs.nightly.outputs.nightly-include }}` || "[]";
|
||||
|
||||
const combined = [
|
||||
...JSON.parse(coreCoverage),
|
||||
...JSON.parse(boardChanges),
|
||||
...JSON.parse(nightly)
|
||||
];
|
||||
const combinedUnique = [...new Map(combined.map(el => [JSON.stringify(el), el])).values()];
|
||||
|
||||
const perBoard = {};
|
||||
|
||||
for (const configuration of combinedUnique) {
|
||||
if (!perBoard[configuration.board])
|
||||
perBoard[configuration.board] = [];
|
||||
|
||||
perBoard[configuration.board].push({
|
||||
shield: configuration.shield,
|
||||
'cmake-args': configuration['cmake-args'],
|
||||
nickname: configuration.nickname
|
||||
})
|
||||
}
|
||||
|
||||
return Object.entries(perBoard).map(([board, shieldArgs]) => ({
|
||||
board,
|
||||
shieldArgs: JSON.stringify(shieldArgs),
|
||||
}));
|
||||
core-coverage:
|
||||
if: ${{ needs.get-changed-files.outputs.core-changes == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: get-changed-files
|
||||
outputs:
|
||||
core-include: ${{ steps.core-list.outputs.result }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "14.x"
|
||||
- name: Install js-yaml
|
||||
run: npm install js-yaml
|
||||
- uses: actions/github-script@v7
|
||||
id: core-list
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const coreCoverage = yaml.load(fs.readFileSync('app/core-coverage.yml', 'utf8'));
|
||||
|
||||
let include = coreCoverage.board.flatMap(board =>
|
||||
coreCoverage.shield.map(shield => ({ board, shield }))
|
||||
);
|
||||
|
||||
return [...include, ...coreCoverage.include];
|
||||
board-changes:
|
||||
if: ${{ needs.get-changed-files.outputs.board-changes == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [get-grouped-hardware, get-changed-files]
|
||||
outputs:
|
||||
boards-include: ${{ steps.boards-list.outputs.result }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "14.x"
|
||||
- name: Install js-yaml
|
||||
run: npm install js-yaml
|
||||
- uses: actions/github-script@v7
|
||||
id: boards-list
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const changedFiles = JSON.parse(`${{ needs.get-changed-files.outputs.changed-files }}`);
|
||||
const metadata = JSON.parse(`${{ needs.get-grouped-hardware.outputs.organized-metadata }}`);
|
||||
const boardChanges = new Set(changedFiles.filter(f => f.startsWith('app/boards')).map(f => f.split('/').slice(0, 4).join('/')));
|
||||
|
||||
return (await Promise.all([...boardChanges].flatMap(async bc => {
|
||||
const globber = await glob.create(bc + "/*.zmk.yml");
|
||||
const files = await globber.glob();
|
||||
|
||||
const aggregated = files.flatMap((f) =>
|
||||
yaml.loadAll(fs.readFileSync(f, "utf8"))
|
||||
);
|
||||
|
||||
const boardAndShield = (b, s) => {
|
||||
if (s.siblings) {
|
||||
return s.siblings.map(shield => ({
|
||||
board: b.id,
|
||||
shield,
|
||||
}));
|
||||
} else {
|
||||
return {
|
||||
board: b.id,
|
||||
shield: s.id
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return aggregated.flatMap(hm => {
|
||||
switch (hm.type) {
|
||||
case "board":
|
||||
if (hm.features && hm.features.includes("keys")) {
|
||||
if (hm.siblings) {
|
||||
return hm.siblings.map(board => ({
|
||||
board,
|
||||
}));
|
||||
} else {
|
||||
return {
|
||||
board: hm.id
|
||||
};
|
||||
}
|
||||
} else if (hm.exposes) {
|
||||
return hm.exposes.flatMap(i =>
|
||||
metadata.interconnects[i].shields.flatMap(s => boardAndShield(hm, s))
|
||||
);
|
||||
} else {
|
||||
console.error("Board without keys or interconnect");
|
||||
}
|
||||
break;
|
||||
case "shield":
|
||||
if (hm.features && hm.features.includes("keys")) {
|
||||
return hm.requires.flatMap(i =>
|
||||
metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm))
|
||||
);
|
||||
} else {
|
||||
console.warn("Unhandled shield without keys");
|
||||
return [];
|
||||
}
|
||||
break;
|
||||
case "interconnect":
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}))).flat();
|
||||
nightly:
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: get-grouped-hardware
|
||||
outputs:
|
||||
nightly-include: ${{ steps.nightly-list.outputs.result }}
|
||||
steps:
|
||||
- name: Create nightly list
|
||||
uses: actions/github-script@v7
|
||||
id: nightly-list
|
||||
with:
|
||||
script: |
|
||||
const metadata = JSON.parse(`${{ needs.get-grouped-hardware.outputs.organized-metadata }}`);
|
||||
|
||||
let includeOnboard = metadata.onboard.flatMap(b => {
|
||||
if (b.siblings) {
|
||||
return b.siblings.map(board => ({
|
||||
board,
|
||||
}));
|
||||
} else {
|
||||
return {
|
||||
board: b.id,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
let includeInterconnect = Object.values(metadata.interconnects).flatMap(i =>
|
||||
i.boards.flatMap(b =>
|
||||
i.shields.flatMap(s => {
|
||||
if (s.siblings) {
|
||||
return s.siblings.map(shield => ({
|
||||
board: b.id,
|
||||
shield,
|
||||
}));
|
||||
} else {
|
||||
return {
|
||||
board: b.id,
|
||||
shield: s.id,
|
||||
};
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
return [...includeOnboard, ...includeInterconnect];
|
||||
get-grouped-hardware:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
organized-metadata: ${{ steps.organize-metadata.outputs.result }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "14.x"
|
||||
- name: Install js-yaml
|
||||
run: npm install js-yaml
|
||||
- name: Aggregate Metadata
|
||||
uses: actions/github-script@v7
|
||||
id: aggregate-metadata
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const globber = await glob.create("app/boards/**/*.zmk.yml");
|
||||
const files = await globber.glob();
|
||||
|
||||
const aggregated = files.flatMap((f) =>
|
||||
yaml.loadAll(fs.readFileSync(f, "utf8"))
|
||||
);
|
||||
|
||||
return JSON.stringify(aggregated).replace(/\\/g,"\\\\").replace(/`/g,"\\`");
|
||||
result-encoding: string
|
||||
|
||||
- name: Organize Metadata
|
||||
uses: actions/github-script@v7
|
||||
id: organize-metadata
|
||||
with:
|
||||
script: |
|
||||
const hardware = JSON.parse(`${{ steps.aggregate-metadata.outputs.result }}`);
|
||||
|
||||
const grouped = hardware.reduce((agg, hm) => {
|
||||
switch (hm.type) {
|
||||
case "board":
|
||||
if (hm.features && hm.features.includes("keys")) {
|
||||
agg.onboard.push(hm);
|
||||
} else if (hm.exposes) {
|
||||
hm.exposes.forEach((element) => {
|
||||
let ic = agg.interconnects[element] || {
|
||||
boards: [],
|
||||
shields: [],
|
||||
};
|
||||
ic.boards.push(hm);
|
||||
agg.interconnects[element] = ic;
|
||||
});
|
||||
} else {
|
||||
console.error("Board without keys or interconnect");
|
||||
}
|
||||
break;
|
||||
case "shield":
|
||||
if (hm.features && hm.features.includes("keys")) {
|
||||
hm.requires.forEach((id) => {
|
||||
let ic = agg.interconnects[id] || { boards: [], shields: [] };
|
||||
ic.shields.push(hm);
|
||||
agg.interconnects[id] = ic;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "interconnect":
|
||||
let ic = agg.interconnects[hm.id] || { boards: [], shields: [] };
|
||||
ic.interconnect = hm;
|
||||
agg.interconnects[hm.id] = ic;
|
||||
break;
|
||||
}
|
||||
return agg;
|
||||
},
|
||||
{ onboard: [], interconnects: {} });
|
||||
|
||||
return JSON.stringify(grouped).replace(/\\/g,"\\\\").replace(/`/g,"\\`");
|
||||
result-encoding: string
|
||||
get-changed-files:
|
||||
if: ${{ github.event_name != 'schedule' }}
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
changed-files: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
board-changes: ${{ steps.board-changes.outputs.result }}
|
||||
core-changes: ${{ steps.core-changes.outputs.result }}
|
||||
steps:
|
||||
- uses: tj-actions/changed-files@v42
|
||||
id: changed-files
|
||||
with:
|
||||
json: true
|
||||
escape_json: false
|
||||
- uses: actions/github-script@v7
|
||||
id: board-changes
|
||||
with:
|
||||
script: |
|
||||
const changedFiles = JSON.parse(`${{ steps.changed-files.outputs.all_changed_files }}`);
|
||||
const boardChanges = changedFiles.filter(f => f.startsWith('app/boards'));
|
||||
return boardChanges.length ? 'true' : 'false';
|
||||
result-encoding: string
|
||||
- uses: actions/github-script@v7
|
||||
id: core-changes
|
||||
with:
|
||||
script: |
|
||||
const changedFiles = JSON.parse(`${{ steps.changed-files.outputs.all_changed_files }}`);
|
||||
const boardChanges = changedFiles.filter(f => f.startsWith('app/boards'));
|
||||
const appChanges = changedFiles.filter(f => f.startsWith('app'));
|
||||
const ymlChanges = changedFiles.includes('.github/workflows/build.yml');
|
||||
return boardChanges.length < appChanges.length || ymlChanges ? 'true' : 'false';
|
||||
result-encoding: string
|
36
.github/workflows/doc-checks.yml
vendored
36
.github/workflows/doc-checks.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: Docs Checks
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/doc-checks.yml"
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/doc-checks.yml"
|
||||
- "docs/**"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
working-directory: docs
|
||||
- name: ESLint
|
||||
run: npm run lint
|
||||
working-directory: docs
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
working-directory: docs
|
||||
- name: Build
|
||||
run: npm run build
|
||||
working-directory: docs
|
||||
- name: TypeScript check
|
||||
run: npm run typecheck
|
||||
working-directory: docs
|
@ -1,34 +0,0 @@
|
||||
name: Hardware Metadata Validation
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/hardware-metadata-validation.yml"
|
||||
- "schema/hardware-metadata.schema.json"
|
||||
- "app/boards/**/*.zmk.yml"
|
||||
- "app/scripts/west_commands/metadata.py"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/hardware-metadata-validation.yml"
|
||||
- "schema/hardware-metadata.schema.json"
|
||||
- "app/boards/**/*.zmk.yml"
|
||||
- "app/scripts/west_commands/metadata.py"
|
||||
|
||||
jobs:
|
||||
validate-metadata:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.io/zmkfirmware/zmk-dev-arm:3.5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: pip install -r app/scripts/requirements.txt
|
||||
- name: West init
|
||||
run: west init -l app
|
||||
- name: Update modules (west update)
|
||||
run: west update
|
||||
- name: Export Zephyr CMake package (west zephyr-export)
|
||||
run: west zephyr-export
|
||||
- name: Validate Hardware Metadata
|
||||
working-directory: app
|
||||
run: west metadata check
|
15
.github/workflows/pre-commit.yml
vendored
15
.github/workflows/pre-commit.yml
vendored
@ -1,15 +0,0 @@
|
||||
name: pre-commit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- uses: pre-commit/action@v3.0.1
|
73
.github/workflows/test.yml
vendored
73
.github/workflows/test.yml
vendored
@ -1,73 +0,0 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/test.yml"
|
||||
- "app/tests/**"
|
||||
- "app/src/**"
|
||||
- "app/include/**"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/test.yml"
|
||||
- "app/tests/**"
|
||||
- "app/src/**"
|
||||
- "app/include/**"
|
||||
|
||||
jobs:
|
||||
collect-tests:
|
||||
outputs:
|
||||
test-dirs: ${{ steps.test-dirs.outputs.test-dirs }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Find test directories
|
||||
id: test-dirs
|
||||
run: |
|
||||
cd app/tests/
|
||||
export TESTS=$(ls -d * | grep -v ble | jq -R -s -c 'split("\n")[:-1]')
|
||||
echo "test-dirs=${TESTS}" >> $GITHUB_OUTPUT
|
||||
run-tests:
|
||||
needs: collect-tests
|
||||
strategy:
|
||||
matrix:
|
||||
test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.io/zmkfirmware/zmk-build-arm:3.5
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Cache west modules
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-zephyr-modules
|
||||
with:
|
||||
path: |
|
||||
modules/
|
||||
tools/
|
||||
zephyr/
|
||||
bootloader/
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: Initialize workspace (west init)
|
||||
run: west init -l app
|
||||
- name: Update modules (west update)
|
||||
run: west update
|
||||
- name: Export Zephyr CMake package (west zephyr-export)
|
||||
run: west zephyr-export
|
||||
- name: Test ${{ matrix.test }}
|
||||
working-directory: app
|
||||
run: west test tests/${{ matrix.test }}
|
||||
- name: Archive artifacts
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "${{ matrix.test }}-log-files"
|
||||
path: app/build/**/*.log
|
36
tgrosinger-readme.md
Normal file
36
tgrosinger-readme.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Instructions for building
|
||||
|
||||
1. Install devcontainer cli
|
||||
|
||||
```sh
|
||||
brew install devcontainer
|
||||
```
|
||||
|
||||
2. Setup the devcontainer
|
||||
|
||||
```sh
|
||||
devcontainer up --workspace-path . --docker-path $(which podman)
|
||||
```
|
||||
|
||||
3. Initialize west (this takes a while)
|
||||
|
||||
```sh
|
||||
devcontainer exec --workspace-path . --docker-path $(which podman)
|
||||
west init -l app/
|
||||
west update
|
||||
```
|
||||
|
||||
4. Build the firmware
|
||||
|
||||
```sh
|
||||
cd app
|
||||
west build --pristine -b nice_nano_v2 -- -DSHIELD=chrysemys
|
||||
```
|
||||
|
||||
5. Copy the uf2 file onto the root of the USB mass storage for the keyboard. The uf2 file can be found at `app/build/zephyr/zmk.uf2`.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Docker setup](https://zmk.dev/docs/development/setup/docker)
|
||||
- [Building](https://zmk.dev/docs/development/build-flash)
|
||||
|
Loading…
x
Reference in New Issue
Block a user