Start (not working) on ci/cd build

This commit is contained in:
Neale Pickett 2024-01-08 15:01:43 -07:00
parent 533dd49bdc
commit 6b21cf47d7
3 changed files with 67 additions and 16 deletions

27
.gitea/publish.sh Executable file
View File

@ -0,0 +1,27 @@
#! /bin/sh
set -e
PACKAGE=${GITHUB_REPOSITORY#*/}
VERSION=$GITHUB_REF_NAME
BASE=$GITHUB_SERVER_URL/api/packages/$GITHUB_ACTOR/generic/$PACKAGE/$VERSION
echo "=== Delete $VERSION"
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE
echo
for path in "$@"; do
fn=$(basename "$path")
echo "=== Upload $VERSION/$fn"
curl \
--fail \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--upload-file "$path" \
$BASE/$fn
echo
done

View File

@ -0,0 +1,19 @@
name: vail-adapter
on: [push]
jobs:
build:
runs-on:
- arduino
env:
PACKAGE_API_TOKEN: ${PACKAGE_API_TOKEN}
steps:
- name: check out repository
run: git clone -b $GITHUB_REF_NAME $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
- name: build firmwares
run: make
- name: build zip file
run: make dist
- name: publish
env:
PACKAGE_API_TOKEN: ${{ secrets.PACKAGE_API_TOKEN }}
run: .gitea/publish.sh build/*.zip build/*.hex

View File

@ -1,15 +1,15 @@
FQBN_qtpy = adafruit:samd:adafruit_qtpy_m0 FQBN_qtpy = adafruit:samd:adafruit_qtpy_m0
FQBN_xiao = Seeeduino:samd:seeed_XIAO_m0 FQBN_xiao = Seeeduino:samd:seeed_XIAO_m0
UF2_MOUNT = /mnt/chromeos/removable/Arduino UF2_MOUNT = /mnt/chromeos/removable/Arduino
ARDUINO_DIR = /app/Arduino ARDUINO_DIR = /usr/share/arduino
BUILDER = flatpak run --command ${ARDUINO_DIR}/arduino-builder cc.arduino.arduinoide BUILDER = flatpak run --command ${ARDUINO_DIR}/arduino-builder cc.arduino.arduinoide
default: build/vail-adapter.qtpy.uf2 build/vail-adapter.xiao.uf2 default: vail-adapter.qtpy.uf2 vail-adapter.xiao.uf2
install: build/vail-adapter.xiao.uf2 install: vail-adapter.xiao.uf2
./install.sh $< $(UF2_MOUNT) ./install.sh $< $(UF2_MOUNT)
clean: clean:
rm -rf build/* rm -rf build/
# uf2conv.py is covered by an MIT license. # uf2conv.py is covered by an MIT license.
build/uf2conv.py: build/uf2families.json build/uf2conv.py: build/uf2families.json
@ -26,25 +26,30 @@ build/uf2families.json:
%.qtpy.uf2: %.qtpy.bin build/uf2conv.py %.qtpy.uf2: %.qtpy.bin build/uf2conv.py
build/uf2conv.py -b 0x2000 -c -o $@ $< build/uf2conv.py -b 0x2000 -c -o $@ $<
build/%.qtpy.bin: FQBN = adafruit:samd:adafruit_qtpy_m0 %.qtpy.bin: FQBN = adafruit:samd:adafruit_qtpy_m0
build/%.xiao.bin: FQBN = Seeeduino:samd:seeed_XIAO_m0 %.xiao.bin: FQBN = Seeeduino:samd:seeed_XIAO_m0
build/vail-adapter.%.bin: vail-adapter.ino *.cpp *.h vail-adapter.%.bin: vail-adapter.ino *.cpp *.h core-%/.done
mkdir -p build/$* mkdir -p build/cache
arduino-builder \ arduino-builder \
-build-cache ~/.cache/arduino \ -build-cache build/cache \
-build-path build/$* \ -build-path build/ \
-core-api-version 10813 \ -core-api-version 10813 \
-fqbn $(FQBN) \ -fqbn $(FQBN) \
-hardware ~/.arduino15/packages \ -tools $(ARDUINO_DIR)/tools \
-tools $(ARDUINO_DIR)/tools-builder \ -tools core-$*/ArduinoCore*/ \
-tools ~/.arduino15/packages \
-hardware $(ARDUINO_DIR)/hardware \ -hardware $(ARDUINO_DIR)/hardware \
-hardware ~/.arduino15/packages \ -hardware core-$*/ArduinoCore* \
-built-in-libraries $(ARDUINO_DIR)/libraries \ -built-in-libraries $(ARDUINO_DIR)/libraries \
-libraries ~/Arduino/libraries \ -built-in-libraries core-$*/ArduinoCore*/ \
-compile \ -compile \
$< $<
mv build/$*/vail-adapter.ino.bin $@ mv build/vail-adapter.ino.bin $@
core-xiao/.done:
mkdir -p $(dir $@)
curl -L https://github.com/Seeed-Studio/ArduinoCore-samd/releases/download/v1.8.5/ArduinoCore-samd-1.8.5.tar.bz2 | tar xj -C $(dir $@)
touch $@
upload: vail-adapter.ino upload: vail-adapter.ino
arduino --upload --board $(FQBN) $< arduino --upload --board $(FQBN) $<