From 0f44bb8e913767af8e1b4084e3f12b60b296fc6f Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Tue, 9 Apr 2024 11:39:14 +0900 Subject: [PATCH 1/6] cureve out a workflow to build a firmware --- .github/workflows/build-all.yml | 48 ++++++++++++++++++++++++++++ .github/workflows/build-firmware.yml | 46 ++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/build-all.yml create mode 100644 .github/workflows/build-firmware.yml diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml new file mode 100644 index 000000000..254cdfb38 --- /dev/null +++ b/.github/workflows/build-all.yml @@ -0,0 +1,48 @@ +name: Build all firmwares rev.2 + +on: [ push, workflow_call ] + +jobs: + + build: + + strategy: + matrix: + keyboard: [ keyball39, keyball44, keyball61, keyball46, one47 ] + keymap: [ test, default, via ] + include: + - keyboard: keyball46 + keymap: test_Left + - keyboard: keyball46 + keymap: test_Both + - keyboard: keyball46 + keymap: via_Left + - keyboard: keyball46 + keymap: via_Both + + name: Build ${{ matrix.keyboard }} w/ ${{ matrix.keymap }} + uses: ./.github/workflows/build-firmware.yml + with: + qmk_version: '0.22.14' + keyboard: ${{ matrix.keyboard }} + keymap: ${{ matrix.keymap }} + + check-size: + name: Check size + runs-on: ubuntu-latest + needs: + - build + + steps: + + - uses: actions/download-artifact@v4 + with: + pattern: "*-firmware" + merge-multiple: true + + - name: List size of firmwares + run: | + for f in *.hex ; do + cut -c 2,3 $f | awk '{s+=strtonum("0x" $1)}END{printf "%5d/28672 (%2d%%, %5d bytes free) ",s,s*100/28672,28672-s}' + echo $f + done diff --git a/.github/workflows/build-firmware.yml b/.github/workflows/build-firmware.yml new file mode 100644 index 000000000..20a7716a1 --- /dev/null +++ b/.github/workflows/build-firmware.yml @@ -0,0 +1,46 @@ +name: Build a firmware + +on: + + workflow_call: + inputs: + qmk_version: + default: '0.22.14' + type: string + required: false + keyboard: + type: string + required: true + keymap: + type: string + required: true + +jobs: + + build: + + name: Build firmware for ${{ inputs.keyboard }} w/ ${{ inputs.keymap }} + + runs-on: ubuntu-latest + container: + image: ghcr.io/qmk/qmk_cli:latest + + steps: + + - name: Checkout source + uses: actions/checkout@v4 + + - name: Checkout qmk_firmware + uses: ./.github/actions/checkout-qmk_firmware + + - name: Install a link to own source + run: ln -s $(pwd)/qmk_firmware/keyboards/keyball __qmk__/keyboards/keyball + + - name: Compile and link + run: qmk compile -j 4 -kb keyball/${{ inputs.keyboard }} -km ${{ inputs.keymap }} + + - name: Archive built firmware + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.keyboard }}-${{ inputs.keymap }}-firmware + path: __qmk__/*.hex From 2d189569d3488a04dc2782d5481b399ebf92b083 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Tue, 9 Apr 2024 12:22:16 +0900 Subject: [PATCH 2/6] remove job name --- .github/workflows/build-all.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 254cdfb38..ac860d52d 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -20,7 +20,6 @@ jobs: - keyboard: keyball46 keymap: via_Both - name: Build ${{ matrix.keyboard }} w/ ${{ matrix.keymap }} uses: ./.github/workflows/build-firmware.yml with: qmk_version: '0.22.14' From 8508f29b498f44d7ced7f9ffb275d91f770efab6 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Tue, 9 Apr 2024 12:30:56 +0900 Subject: [PATCH 3/6] replace workflow to build a firmware --- .github/workflows/build-all.yml | 25 +++++++++++++++++++++++-- .github/workflows/build-firmware.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index ac860d52d..158eadf3c 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -1,6 +1,27 @@ -name: Build all firmwares rev.2 +name: Build all firmwares -on: [ push, workflow_call ] +on: + push: + paths: + - 'qmk_firmware/keyboards/keyball/**.mk' + - 'qmk_firmware/keyboards/keyball/**.c' + - 'qmk_firmware/keyboards/keyball/**.h' + - 'qmk_firmware/keyboards/keyball/**.json' + - '.github/**.yml' + tags-ignore: + - '*' + branches: + - '*' + + pull_request: + paths: + - 'qmk_firmware/keyboards/keyball/**.mk' + - 'qmk_firmware/keyboards/keyball/**.c' + - 'qmk_firmware/keyboards/keyball/**.h' + - 'qmk_firmware/keyboards/keyball/**.json' + - '.github/**.yml' + + workflow_call: {} jobs: diff --git a/.github/workflows/build-firmware.yml b/.github/workflows/build-firmware.yml index 20a7716a1..8aa6a9c9f 100644 --- a/.github/workflows/build-firmware.yml +++ b/.github/workflows/build-firmware.yml @@ -19,7 +19,7 @@ jobs: build: - name: Build firmware for ${{ inputs.keyboard }} w/ ${{ inputs.keymap }} + name: Build a firmware ${{ inputs.keyboard }}:${{ inputs.keymap }} runs-on: ubuntu-latest container: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7dc296e3..950926386 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build all firmwares +name: Build all firmwares rev.1 on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5bfc78c53..0154933ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: build: name: Build firmwares - uses: ./.github/workflows/build.yml + uses: ./.github/workflows/build-all.yml deploy: name: Deploy firmwares From e99a0576f1f08dbd9db9632ecc00d6544226ca40 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Tue, 9 Apr 2024 12:35:20 +0900 Subject: [PATCH 4/6] remove unused workflow and action --- .github/actions/setup-qmk/action.yml | 48 --------------- .github/workflows/build.yml | 87 ---------------------------- 2 files changed, 135 deletions(-) delete mode 100644 .github/actions/setup-qmk/action.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/actions/setup-qmk/action.yml b/.github/actions/setup-qmk/action.yml deleted file mode 100644 index 1d1bb9371..000000000 --- a/.github/actions/setup-qmk/action.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: 'Setup QMK firmware' - -inputs: - version: - default: '0.22.3' - type: string - required: false - path: - default: '__qmk__' - type: string - required: false - avrgcc_version: - default: '8.3.0' - type: string - required: false - -runs: - using: 'composite' - steps: - - - name: Install git and pip - shell: bash - run: sudo apt-get install -y git python3-pip libfl2 - - - name: Install QMK CLI - shell: bash - run: python3 -m pip install --user qmk - - - name: Checkout qmk_firmware - uses: actions/checkout@v4 - with: - path: ${{ inputs.path }} - repository: qmk/qmk_firmware - submodules: recursive - ref: ${{ inputs.version }} - - - name: Setup QMK - shell: bash - run: qmk setup --home ${{ inputs.path }} --yes - - - name: Install newer gcc-avr - shell: bash - run: | - # use https://github.com/ZakKemble/avr-gcc-build instead of default - wget -q --show-progress --progress=bar:force https://github.com/ZakKemble/avr-gcc-build/releases/download/v${{ inputs.avrgcc_version }}-1/avr-gcc-${{ inputs.avrgcc_version }}-x64-linux.tar.bz2 -O /tmp/avrgcc.tar.bz2 - sudo tar xjf /tmp/avrgcc.tar.bz2 --strip-components=1 -C /usr/ - rm -f /tmp/avrgcc.tar.bz2 - avr-gcc --version diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 950926386..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Build all firmwares rev.1 - -on: - push: - paths: - - 'qmk_firmware/keyboards/keyball/**.c' - - 'qmk_firmware/keyboards/keyball/**.h' - - 'qmk_firmware/keyboards/keyball/**.json' - - '.github/actions/setup-qmk/**.yml' - - '.github/workflows/build*.yml' - tags-ignore: - - '*' - branches: - - '*' - - pull_request: - paths: - - 'qmk_firmware/keyboards/keyball/**.c' - - 'qmk_firmware/keyboards/keyball/**.h' - - 'qmk_firmware/keyboards/keyball/**.json' - - '.github/actions/setup-qmk/**.yml' - - '.github/workflows/build*.yml' - - workflow_call: {} - -jobs: - - build: - - strategy: - matrix: - keyboard: [ keyball39, keyball44, keyball61, keyball46, one47 ] - keymap: [ test, default, via ] - include: - - keyboard: keyball46 - keymap: test_Left - - keyboard: keyball46 - keymap: test_Both - - keyboard: keyball46 - keymap: via_Left - - keyboard: keyball46 - keymap: via_Both - - name: Build ${{ matrix.keyboard }} w/ ${{ matrix.keymap }} - - runs-on: ubuntu-latest - container: - image: ghcr.io/qmk/qmk_cli:latest - - steps: - - - name: Checkout source - uses: actions/checkout@v4 - - - name: Checkout qmk_firmware - uses: ./.github/actions/checkout-qmk_firmware - - - name: Install a link to own source - run: ln -s $(pwd)/qmk_firmware/keyboards/keyball __qmk__/keyboards/keyball - - - run: qmk compile -j 4 -kb keyball/${{ matrix.keyboard }} -km ${{ matrix.keymap }} - - - name: Archive built firmware - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.keyboard }}-${{ matrix.keymap }}-firmware - path: __qmk__/*.hex - - check-size: - name: Check size - runs-on: ubuntu-latest - needs: - - build - - steps: - - - uses: actions/download-artifact@v4 - with: - pattern: "*-firmware" - merge-multiple: true - - - name: List size of firmwares - run: | - for f in *.hex ; do - cut -c 2,3 $f | awk '{s+=strtonum("0x" $1)}END{printf "%5d/28672 (%2d%%, %5d bytes free) ",s,s*100/28672,28672-s}' - echo $f - done From 6666b60105f058843da88ee5779c3594e6899b4b Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Tue, 9 Apr 2024 13:09:41 +0900 Subject: [PATCH 5/6] Added method to build a firmware manually --- .github/workflows/build-user.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build-user.yml diff --git a/.github/workflows/build-user.yml b/.github/workflows/build-user.yml new file mode 100644 index 000000000..a0ddc12b0 --- /dev/null +++ b/.github/workflows/build-user.yml @@ -0,0 +1,30 @@ +name: Build a firmware on demand + +on: + workflow_dispatch: + inputs: + keyboard: + description: 'Keyboard' + required: true + type: choice + options: + - keyball39 + - keyball44 + - keyball61 + - keyball46 + - one47 + keymap: + description: 'Keymap' + required: true + type: string + default: 'default' + +jobs: + + build: + + uses: ./.github/workflows/build-firmware.yml + with: + qmk_version: '0.22.14' + keyboard: ${{ inputs.keyboard }} + keymap: ${{ inputs.keymap }} From 5bb94e9aa30c61aa48b8f7ecbfeb2a6c2f6fbfda Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Tue, 9 Apr 2024 13:27:56 +0900 Subject: [PATCH 6/6] doc for on demand build with GitHub Actions --- qmk_firmware/keyboards/keyball/readme.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/qmk_firmware/keyboards/keyball/readme.md b/qmk_firmware/keyboards/keyball/readme.md index 804a6a826..3027c69d0 100644 --- a/qmk_firmware/keyboards/keyball/readme.md +++ b/qmk_firmware/keyboards/keyball/readme.md @@ -66,4 +66,19 @@ There are three keymaps provided at least: ## How to create your keymap -(TO BE DOCUMENTED) +1. Fork this Yowkees/keyball repository +2. Checkout forked repository +3. (OPTIONAL) Create a new branch +4. Add a your keymap, or make some changes +5. Commit changes and push it to your forked repository +6. Open your forked repository with web browser +7. Click and open "Actions" tab +8. Click "Build a firmware on demand" in Workflows on left panel +9. Press "Run workflow" button on right side, then you will see forms +10. (OPTIONAL) Select a your working branch +11. Select a "Keyboard" from drop-down list +12. Enter the "keymap" you want to build +13. Click "Run workflow" +14. Wait a minute until the firmware build is finished +15. Click a latest workflow run and open details +16. Download built firmware in "Artifacts" section