Skip to content

Commit

Permalink
feat: add new hardware-installer
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Nov 30, 2023
1 parent 883c475 commit 461065d
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 3 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
56 changes: 56 additions & 0 deletions .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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: |
- bitcoinSwitch
libraries: |
- name: WebSockets
- name: ArduinoJson
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
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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
- name: Create github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" --generate-notes ./build/lnPoSTdisplay.ino.bootloader.bin \
./build/lnPoSTdisplay.ino.bin ./build/lnPoSTdisplay.ino.partitions.bin
54 changes: 54 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: build webinstaller
run: |
sh build-webinstaller.sh
cd hardware-installer
npm install
npx vite build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "hardware-installer/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tmp
.vscode
.vscode
build
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ arduino-cli config --additional-urls https://raw.githubusercontent.com/espressif
arduino-cli core update-index
arduino-cli core install esp32:esp32
arduino-cli upgrade
arduino-cli lib install WebSockets ArduinoJson AutoConnect Base64 Keypad PageBuilder TFT_eSPI uBitcoin
arduino-cli compile --library ./libraries/QRCode --build-path build --fqbn esp32:esp32:ttgo-lora32 lnPoSTdisplay
arduino-cli lib install WebSockets ArduinoJson AutoConnect Base64 Keypad PageBuilder uBitcoin
arduino-cli compile \
--library ./lnPoSTdisplay/libraries/TFT_eSPI \
--library ./lnPoSTdisplay/libraries/QRCode \
--build-path build --fqbn esp32:esp32:ttgo-lora32 lnPoSTdisplay

0 comments on commit 461065d

Please sign in to comment.