-
Notifications
You must be signed in to change notification settings - Fork 15
133 lines (129 loc) · 7.31 KB
/
BlueHand.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Use this workflow to initialize your repository with the fimware you need for your keyboard
# if you have multiple keyboards, you need to have 1 copy of this file per keyboard
# rename the name below so that you can see the different keyboards in your github actions
name: BlueHand-4x2
# You will need to manually trigger this workflow
on: ['workflow_dispatch']
jobs:
initialize-firmware:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
# Replace the following with the keyboard you want to setup.
# Only 1 keyboard is supported. For more keyboards, copy and rename this file.
keyboard: ['bluehand']
# Keymap of the keyboard to setup. Multiple keymaps can be setup following this example: ['default','jpconstantineau']
keymap: ['test']
# keyboard configuration. Multiple configs can be setup following this example: ['left','right']
keyboard_config: ['single']
# hardware configuration. must have both components of the path in the BlueMicro_BLE keyboard examples path
hardware_config: ['bluehand']
# Available options
# feather52832 - use this for most nRF52832 based boards (needs Arduino_nRF52_Bootloader)
# bluemicro_nrf52840
# bluemacro_nrf52840
# nice_nano
# pca10056 - use this for all other nRF52840 based boards not listed above (needs Arduino_nRF52_Bootloader)
compile_with: ['bluemicro_nrf52840']
# you shouldn't need to edit anything below
steps:
- name: checkout builder repo
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: update from last run
run: git pull
- name: setup conditions
id: job_conditions
run: |
if [ -d ${{ matrix.keyboard }}-${{ matrix.keymap }}-${{ matrix.keyboard_config }}-${{ matrix.compile_with }} ]; then
echo "::set-output name=firmware-here::true"
else
echo "::set-output name=firmware-here::false"
fi
- name: clone BlueMicro_BLE repository
if: ${{ steps.job_conditions.outputs.firmware-here == 'false' }}
run: |
git clone https://github.com/jpconstantineau/BlueMicro_BLE.git
- name: setup job variables
id: job_variables
run: |
echo "::set-output name=firmware-name::${{ matrix.keyboard }}-${{ matrix.keymap }}-${{ matrix.keyboard_config }}-${{ matrix.compile_with }}"
echo "::set-output name=hardware-config::$(find BlueMicro_BLE/firmware/keyboards/${{ matrix.keyboard }}/hardware/ -name hardware_config.h | grep ${{ matrix.hardware_config }} )"
- name: create firmware folder
if: ${{ steps.job_conditions.outputs.firmware-here == 'false' }}
run: |
mkdir ${{ steps.job_variables.outputs.firmware-name }}
- name: copy main firmware files
if: ${{ steps.job_conditions.outputs.firmware-here == 'false' }}
run: |
cp BlueMicro_BLE/firmware/*.cpp ${{ steps.job_variables.outputs.firmware-name }}
cp BlueMicro_BLE/firmware/*.h ${{ steps.job_variables.outputs.firmware-name }}
cp BlueMicro_BLE/firmware/firmware.ino ${{ steps.job_variables.outputs.firmware-name }}/${{ steps.job_variables.outputs.firmware-name }}.ino
- name: copy board specific files
if: ${{ steps.job_conditions.outputs.firmware-here == 'false' }}
run: |
cp BlueMicro_BLE/firmware/keyboards/${{ matrix.keyboard }}/config/${{ matrix.keyboard_config }}/keyboard_config.h ${{ steps.job_variables.outputs.firmware-name }}
cp ${{ steps.job_variables.outputs.hardware-config }} ${{ steps.job_variables.outputs.firmware-name }}
cp BlueMicro_BLE/firmware/keyboards/${{ matrix.keyboard }}/keymaps/${{ matrix.keymap }}/keymap.h ${{ steps.job_variables.outputs.firmware-name }}
cp BlueMicro_BLE/firmware/keyboards/${{ matrix.keyboard }}/keymaps/${{ matrix.keymap }}/keymap.cpp ${{ steps.job_variables.outputs.firmware-name }}
- name: remove BlueMicro_BLE repository
if: ${{ steps.job_conditions.outputs.firmware-here == 'false' }}
run: |
rm -r BlueMicro_BLE
- name: check back in the changes to this repo
if: ${{ steps.job_conditions.outputs.firmware-here == 'false' }}
run: |
ls -l
git config --global user.name 'gh-actions'
git config --global user.email '[email protected]'
git add ${{ steps.job_variables.outputs.firmware-name }}
git commit -m "Initialized ${{ steps.job_variables.outputs.firmware-name }} using GitHub Actions"
git push
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
# We use the arduino/setup-arduino-cli action to install and
# configure the Arduino CLI on the system.
- name: Setup Arduino CLI
uses: arduino/[email protected]
- name: Install BSP and Libraries
env:
BSP_URL: https://github.com/jpconstantineau/Community_nRF52_Arduino/releases/latest/download/package_jpconstantineau_boards_index.json
BSP_PATH: .arduino15/packages/community_nrf52/hardware/nrf52
BSP_URL_ADA: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
BSP_PATH_ADA: .arduino15/packages/adafruit/hardware/nrf52
run: |
pip3 install adafruit-nrfutil
arduino-cli config init
arduino-cli core update-index
arduino-cli core update-index --additional-urls $BSP_URL_ADA
arduino-cli core install adafruit:nrf52 --additional-urls $BSP_URL_ADA
arduino-cli core update-index --additional-urls $BSP_URL
arduino-cli core install community_nrf52:nrf52 --additional-urls $BSP_URL
arduino-cli core list
arduino-cli board listall
arduino-cli lib list
- name: Compile Fimware
env:
BSP_PATH: .arduino15/packages/adafruit/hardware/nrf52
run: |
arduino-cli compile --fqbn community_nrf52:nrf52:${{ matrix.compile_with }} ./${{ steps.job_variables.outputs.firmware-name }} --output-dir ./${{ steps.job_variables.outputs.firmware-name }}/build
- name: Create UF2 for nRF52840 boards
# nrf52832 boards don't support uf2 uploads.
# feather_nrf52832 or 4x4macropad_nrf52832 or bluemicro2_1
if: ${{ (matrix.compile_with != 'feather_nrf52832') && (matrix.compile_with != '4x4macropad_nrf52832') && (matrix.compile_with != 'bluemicro2_1') }}
env:
BSP_PATH: .arduino15/packages/adafruit/hardware/nrf52
run: |
BSP_VERSION=`eval ls $HOME/$BSP_PATH`
python $HOME/$BSP_PATH/$BSP_VERSION/tools/uf2conv/uf2conv.py ./${{ steps.job_variables.outputs.firmware-name }}/build/${{ steps.job_variables.outputs.firmware-name }}.ino.hex -c -f 0xADA52840 -o ./${{ steps.job_variables.outputs.firmware-name }}/build/${{ steps.job_variables.outputs.firmware-name }}.ino.uf2
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.job_variables.outputs.firmware-name }}
path: |
${{ steps.job_variables.outputs.firmware-name }}/build