Enable CI/CD
Mockband / build (push) Successful in 17s Details

This commit is contained in:
Neale Pickett 2024-01-04 21:36:17 -07:00
parent 1007b963fa
commit 784758ca09
3 changed files with 89 additions and 0 deletions

46
.gitea/build.sh Executable file
View File

@ -0,0 +1,46 @@
#! /bin/sh
set -e
log () {
echo "=== $*"
}
# Make sure we're in the project directory
cd $(dirname $0)/..
mkdir -p out/
while read vid pid variant; do
log
log Building $vid $pid $product
log
## This is bananas.
rm -rf build/
mkdir -p build/cache/
cp -rL /usr/share/arduino /usr/share/arduino-builder build/ || true # there's a cyclic symlink that causes failure
sed -i "
/leonardo.build.vid/ s/=.*/=$vid/
/leonardo.build.pid/ s/=.*/=$pid/
/leonardo.build.usb_product/ s/=.*/=\"Mockband $variant\"/
" build/arduino/hardware/arduino/avr/boards.txt
grep 'leonardo.build' build/arduino/hardware/arduino/avr/boards.txt
arduino-builder \
-fqbn arduino:avr:leonardo \
-build-path $(pwd)/build/ \
-build-cache $(pwd)/build/cache/ \
-hardware build/arduino/hardware \
-tools build/arduino/tools \
-compile MockBand.ino
mv build/MockBand.ino.hex out/MockBand.$variant.hex
find out build/cache
done << EOD
0x1bad 0x0004 guitar
0x1bad 0x3110 drums
EOD
ls -l out/

26
.gitea/publish.sh Executable file
View File

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

View File

@ -0,0 +1,17 @@
name: Mockband
on: [push]
jobs:
build:
runs-on:
- arduino
env:
PACKAGE_API_TOKEN: ${PACKAGE_API_TOKEN}
steps:
- name: check out repository
run: git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
- name: build
run: .gitea/build.sh
- name: publish
env:
PACKAGE_API_TOKEN: ${{ secrets.PACKAGE_API_TOKEN }}
run: .gitea/publish.sh out/*