diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2608f0f9..00d3e9b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,74 @@ -on: [push, pull_request, workflow_dispatch] +on: + push: + pull_request: + workflow_dispatch: jobs: build: - uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main + runs-on: ubuntu-latest + + container: + image: zmkfirmware/zmk-build-arm:stable + + strategy: + matrix: + include: + - { board: hw75@1.1, keymap: hw75.keymap } + - { board: hw75@1.2, keymap: hw75.keymap } + - { board: hw75_dynamic, keymap: hw75_dynamic.keymap } + + steps: + - name: Prepare variables + run: | + echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v3 + + - name: Cache west modules + uses: actions/cache@v3.0.11 + continue-on-error: true + env: + cache_name: cache-zephyr-${{ env.zephyr_version }}-modules + with: + path: | + modules/ + zephyr/ + 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: Prepare west + run: | + west init -l config + west update + west zephyr-export + + - name: West build + run: | + west build -s zmk/app -b ${{ matrix.board }} -- \ + -DZMK_CONFIG=${GITHUB_WORKSPACE}/config \ + -DKEYMAP_FILE=${GITHUB_WORKSPACE}/config/${{ matrix.keymap }} + + - name: Rename artifacts + run: | + mkdir build/artifacts + if [ -f build/zephyr/zmk.uf2 ]; then + cp build/zephyr/zmk.uf2 "build/artifacts/${{ matrix.board }}-zmk.uf2" + fi + if [ -f build/zephyr/zmk.hex ]; then + cp build/zephyr/zmk.hex "build/artifacts/${{ matrix.board }}-zmk.hex" + fi + cp build/zephyr/zmk.bin "build/artifacts/${{ matrix.board }}-zmk.bin" + + - name: Archive + uses: actions/upload-artifact@v3 + with: + name: firmware + path: build/artifacts release: if: ${{ startsWith(github.ref, 'refs/tags/') }} @@ -20,7 +86,7 @@ jobs: - name: Publish release uses: svenstaro/upload-release-action@v2 with: - file: firmware/*.uf2 + file: firmware/* file_glob: true tag: ${{ github.ref }} repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build_dynamic.yml b/.github/workflows/build_dynamic.yml deleted file mode 100644 index e706eae2..00000000 --- a/.github/workflows/build_dynamic.yml +++ /dev/null @@ -1,29 +0,0 @@ -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main - with: - build_matrix_path: build_dynamic.yaml - fallback_binary: hex - - release: - if: ${{ startsWith(github.ref, 'refs/tags/') }} - needs: build - - runs-on: ubuntu-latest - - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: firmware - path: firmware - - - name: Publish release - uses: svenstaro/upload-release-action@v2 - with: - file: firmware/*.hex - file_glob: true - tag: ${{ github.ref }} - repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.yaml b/build.yaml deleted file mode 100644 index 2a8c3e02..00000000 --- a/build.yaml +++ /dev/null @@ -1,6 +0,0 @@ -board: - - hw75@1.1 - - hw75@1.2 - -cmake-args: - - -DKEYMAP_FILE=${GITHUB_WORKSPACE}/config/hw75.keymap diff --git a/build_dynamic.yaml b/build_dynamic.yaml deleted file mode 100644 index ed8af8d4..00000000 --- a/build_dynamic.yaml +++ /dev/null @@ -1,5 +0,0 @@ -board: - - hw75_dynamic - -cmake-args: - - -DKEYMAP_FILE=${GITHUB_WORKSPACE}/config/hw75_dynamic.keymap