Skip to content

SUKU gracefully handle steps=0 #277

SUKU gracefully handle steps=0

SUKU gracefully handle steps=0 #277

name: Combined Firmware Workflow
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
push:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo and submodules
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Install GNU Arm Embedded Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '9-2020-q2' # <-- The compiler release to use
- name: Test ARM GCC and build D51 firmware variant
run: |
arm-none-eabi-gcc -v
cd grid_make/gcc && make release_automation
- name: Build Docker image containing both IDF and PICOSDK
run: docker build -t my-image .
- name: Run script in Docker container
run: docker run -v $PWD:/project -w /project/ my-image sh -c "./pico_build_firmware.sh && ./esp_build_firmware.sh && ./gui_build.sh"
- name: Convert ESP firmware to UF2
run: |
cd ./grid_esp
mkdir ./output
python3 ./tools/uf2conv.py -f ESP32S3 ./build/grid_fw.bin -b 0x0 -c -o ./output/grid_fw.uf2
- name: Set env
shell: bash
run: |
echo "ACTION_DATE=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(git tag --contains ${{ github.sha }})" >> $GITHUB_ENV
- name: Copy and rename the artifacts
run: |
ls
cp binary/grid_release.uf2 grid_d51_release_${{ env.ACTION_DATE }}.uf2
cp grid_esp/output/grid_fw.uf2 grid_esp32_release_${{ env.ACTION_DATE }}.uf2
cp binary/grid_release.uf2 grid_d51_nightly_${{ env.ACTION_DATE }}.uf2
cp binary/grid_release.uf2 grid_d51_nightly.uf2
cp grid_esp/output/grid_fw.uf2 grid_esp32_nightly_${{ env.ACTION_DATE }}.uf2
cp grid_esp/output/grid_fw.uf2 grid_esp32_nightly.uf2
cp .github/workflows/INSTRUCTIONS.txt INSTRUCTIONS__USE_D51_VERSION_IF_UNSURE.txt
cp grid_gui/build/index.html index.html
cp grid_gui/build/index.js index.js
cp grid_gui/build/index.wasm index.wasm
- uses: actions/upload-artifact@v4
with:
name: grid-fw nightly
path: |
grid_esp32_nightly_${{ env.ACTION_DATE }}.uf2
grid_d51_nightly_${{ env.ACTION_DATE }}.uf2
grid_esp32_nightly.uf2
grid_d51_nightly.uf2
index.html
index.js
index.wasm
- name: Zipping artifacts for Github Release
uses: vimtor/action-zip@v1
if: ${{ env.RELEASE_VERSION != '' }}
with:
files: grid_d51_release_${{ env.ACTION_DATE }}.uf2 grid_esp32_release_${{ env.ACTION_DATE }}.uf2 INSTRUCTIONS__USE_D51_VERSION_IF_UNSURE.txt
dest: grid_release.zip
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ env.RELEASE_VERSION != '' }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Grid ${{ env.RELEASE_VERSION }} (${{ env.ACTION_DATE }})
files: grid_release.zip
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy-simulator:
if: github.ref == 'refs/heads/master'
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Download reports' artifacts
uses: actions/download-artifact@v4
with:
path: download
- name: Collecting files
run: |
cd download
ls
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './download/grid-fw nightly/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
deploy-results:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: build
steps:
- uses: actions/checkout@v2
with:
ref: preview
- name: Download reports' artifacts
uses: actions/download-artifact@v4
with:
path: download
- name: Collecting files
run: |
# Create the temp folder if it doesn't exist
mkdir -p Preview/Firmware
# Loop through each subdirectory in the download folder
for subdirectory in download/*; do
# Check if it is a directory
if [ -d "$subdirectory" ]; then
# Copy the contents of the subdirectory to the temp folder
cp -r "$subdirectory"/* "Preview/Firmware/"
fi
done
- name: Commit the files
run: |
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ github.actor }}@users.noreply.github.com
git add Preview/*
git commit -m "BOT ${{ github.workflow }} ${{ github.sha }}"
git push