Skip to content

Jazzlights: Build and Test Code; Deploy Pages #4

Jazzlights: Build and Test Code; Deploy Pages

Jazzlights: Build and Test Code; Deploy Pages #4

Workflow file for this run

name: "Jazzlights: Build and Test Code; Deploy Pages"
on:
push:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check format
run: ./check_format.sh
extras:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
- name: Download and Install GLFW3 Dependency
run: |
GLFW_VERSION=$(curl -Ls https://api.github.com/repos/glfw/glfw/releases/latest | grep tag_name | sed 's/.*:[^"]"\([^"]*\)".*/\1/')
echo ${GLFW_VERSION}
curl -OLs https://github.com/glfw/glfw/releases/download/${GLFW_VERSION}/glfw-${GLFW_VERSION}.zip
rm -rf glfw-${GLFW_VERSION} >/dev/null 2>&1
unzip -q glfw-${GLFW_VERSION}.zip
cmake -S glfw-${GLFW_VERSION} -B glfw-${GLFW_VERSION}/build
sudo make -C glfw-${GLFW_VERSION}/build install
- name: Prepare CMake Files
run: cmake -S extras -B extras/build
- name: Build
run: cmake --build extras/build
platformio:
needs:
- check-format
- extras
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python Dependencies
run: pip install --upgrade platformio beautifulsoup4 lxml
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install Kramdown
run: gem install kramdown
- name: Setup Pages
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@v5
- name: Create Temporary Site Directory
run: |
mkdir -p "${{ runner.temp }}/site-upload"
echo "upload_dir=${{ runner.temp }}/site-upload" >> "$GITHUB_ENV"
- name: Create HTML from Markdown
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
url=$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url')
extras/site/create-html.py --template extras/site/template.html --markdown README.md --url $url --output "${upload_dir}/index.html"
extras/site/create-html.py --template extras/site/template.html --markdown extras/docs/VEST.md --url $url --title "JazzLights Vest" --output "${upload_dir}/vest.html"
- name: Copy Images
run: cp -R extras/docs/images "${upload_dir}/"
- name: Copy Static Files to Flash Folder
run: |
mkdir -p "${upload_dir}/flash/esp-web-tools"
cp -R extras/site/flash/esp-web-tools/*.js "${upload_dir}/flash/esp-web-tools/"
cp extras/site/flash/index.html "${upload_dir}/flash/"
cp extras/site/style.css "${upload_dir}/"
extras/site/flash/manifest.py --output "${upload_dir}/flash/manifest-vest.json" --name "JazzLights Vest" --version $(git rev-parse --short "$GITHUB_SHA") --firmware vest.bin --firmware-s3 vest_s3.bin
extras/site/flash/manifest.py --output "${upload_dir}/flash/manifest-shoe.json" --name "JazzLights Shoe" --version $(git rev-parse --short "$GITHUB_SHA") --firmware shoe.bin
extras/site/flash/manifest.py --output "${upload_dir}/flash/manifest-hat.json" --name "JazzLights Hat" --version $(git rev-parse --short "$GITHUB_SHA") --firmware hat.bin
- name: PlatformIO Build
run: pio run
- name: PlatformIO Test
run: pio test -e native
- name: PlatformIO Build Merged Vest Binary
run: MERGED_BIN_PATH="${upload_dir}/flash/vest.bin" pio run -t mergebin -e vest
- name: PlatformIO Build Merged Vest S3 Binary
run: MERGED_BIN_PATH="${upload_dir}/flash/vest_s3.bin" pio run -t mergebin -e vest_s3
- name: PlatformIO Build Merged Shoe Binary
run: MERGED_BIN_PATH="${upload_dir}/flash/shoe.bin" pio run -t mergebin -e shoe
- name: PlatformIO Build Merged Hat Binary
run: MERGED_BIN_PATH="${upload_dir}/flash/hat.bin" pio run -t mergebin -e hat
- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: "${{ runner.temp }}/site-upload"
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4