Skip to content

Commit

Permalink
huge commit :)
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Oct 30, 2023
1 parent 438fcd0 commit bd034b6
Show file tree
Hide file tree
Showing 17 changed files with 235 additions and 124 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/arduino-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on:
schedule:
- cron: '*/5 * * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: arduino/report-size-deltas@v1
63 changes: 63 additions & 0 deletions .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: arduino
on: [ push, pull_request ]

jobs:
build-for-esp32:
runs-on: ubuntu-latest
strategy:
matrix:
fqbn:
- esp32:esp32:esp32
# - esp32:esp32:esp32s3
# - esp32:esp32:esp32c3
# future bluetooth chips
#- esp32:esp32:esp32c2
#- esp32:esp32:esp32c6
#- esp32:esp32:esp32h2

steps:
- uses: actions/checkout@v3
- uses: arduino/compile-sketches@v1
with:
enable-deltas-report: true
github-token: ${{ secrets.GITHUB_TOKEN }}
fqbn: ${{ matrix.fqbn }}
platforms: |
- name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
sketch-paths: |
- nostrZapLamp
libraries: |
- name: WebSockets
- name: ArduinoJson
- name: uBitcoin
- name: base64
- name: Button
- name: WiFiManager
- name: Nostr
# - name: QRCode
# - name: ESP32Ping
cli-compile-flags: |
- --warnings="none"
- uses: actions/upload-artifact@v2
with:
name: sketches-reports
path: sketches-reports


report:
needs: build-for-esp32
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifact
uses: actions/download-artifact@v2
with:
name: sketches-reports
path: sketches-reports

- uses: arduino/report-size-deltas@v1
with:
sketches-reports-source: sketches-reports
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

jobs:
release:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
ref: main

- name: update version in repo
env:
tag: ${{ github.ref_name }}
run: |
tmp=$(mktemp)
jq --arg version $tag '.versions |= [$version] + .' versions.json > "$tmp" && mv "$tmp" versions.json
git config --global user.name 'Alan Bits'
git config --global user.email '[email protected]'
git commit -am "[CHORE] update version to $tag"
git push
git push --delete origin $tag
git tag -fa $tag -m "update via workflow"
git push --tags
- name: Install Arduino CLI
uses: arduino/setup-arduino-cli@v1

- name: build sketch with arduino cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
sh build.sh
sh release.sh $tag
- name: Create github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" --generate-notes ./dist/$tag/bootloader.bin ./dist/$tag/boot_app0.bin \
./dist/$tag/nostrZapLamp.ino.bin ./dist/$tag/nostrZapLamp.ino.partitions.bin
pages:
needs: [ release ]
uses: ./.github/workflows/static.yml
46 changes: 46 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allows you to run this workflow from other workflows
workflow_call:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: copy main assets
run: sh build-webinstaller.sh
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "hardware-installer"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.vscode/ipch
pcb/*.lck
pcb/NostrZapLamp-backups
build
20 changes: 20 additions & 0 deletions build-webinstaller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
INSTALLER_PATH=./hardware-installer/src/firmware/esp32
REPO=https://github.com/lnbits/bitcoinswitch/releases/download
PROJECT_NAME=nostrZapLamp

git clone https://github.com/lnbits/hardware-installer
mkdir -p $INSTALLER_PATH
cp versions.json ./hardware-installer/src/versions.json

for version in $(jq -r '.versions[]' ./hardware-installer/src/versions.json); do
mkdir -p $INSTALLER_PATH/$version
wget $REPO/$version/bootloader.bin
mv bootloader.bin $INSTALLER_PATH/$version
wget $REPO/$version/boot_app0.bin
mv boot_app0.bin $INSTALLER_PATH/$version
wget $REPO/$version/$PROJECT_NAME.ino.bin
mv $PROJECT_NAME.ino.bin $INSTALLER_PATH/$version
wget $REPO/$version/$PROJECT_NAME.ino.partitions.bin
mv $PROJECT_NAME.ino.partitions.bin $INSTALLER_PATH/$version
done
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
command -v arduino-cli >/dev/null 2>&1 || { echo >&2 "arduino-cli not found. Aborting."; exit 1; }
arduino-cli config --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json init
arduino-cli core update-index
arduino-cli core install esp32:esp32
arduino-cli upgrade
arduino-cli lib install uBitcoin WebSockets ArduinoJson base64 Button WiFiManager Nostr # QRCode ESP32Ping
arduino-cli compile --build-path build --fqbn esp32:esp32:esp32 --build-properties build.partitions=min_spiffs,upload.maximum_size=1966080 nostrZapLamp
39 changes: 0 additions & 39 deletions code/include/README

This file was deleted.

46 changes: 0 additions & 46 deletions code/lib/README

This file was deleted.

11 changes: 0 additions & 11 deletions code/test/README

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes
Loading

0 comments on commit bd034b6

Please sign in to comment.