From 5f9af4a0f8e7f351da02e949e31c59f8a6950305 Mon Sep 17 00:00:00 2001 From: Eric McDaniel Date: Fri, 13 Feb 2026 17:27:24 -0600 Subject: [PATCH 1/2] Restore old pipeline --- .github/workflows/build-ci.yaml | 67 ++++++--------------------------- 1 file changed, 11 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build-ci.yaml b/.github/workflows/build-ci.yaml index dcc865a..edd5413 100644 --- a/.github/workflows/build-ci.yaml +++ b/.github/workflows/build-ci.yaml @@ -1,79 +1,34 @@ -name: LumenLab CI/CD +name: Build on: pull_request: - + types: [opened, synchronize, reopened] push: - branches-ignore: + branches: - main - tags-ignore: - - 'v*' - - workflow_dispatch: {} jobs: build_and_test: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Cache PlatformIO & pip - uses: actions/cache@v4 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: | ~/.cache/pip ~/.platformio/.cache key: ${{ runner.os }}-pio - - - name: Setup Python - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5 with: python-version: '3.11' - - name: Inject credentials run: python3 ${{ github.workspace }}/tools/setup_dev_env.py - - name: Install PlatformIO + - name: Install platformio core libraries run: pip install --upgrade platformio - - name: Build LumenLab firmware - run: pio run --environment release - - - name: Run native tests - run: pio test --environment native - - docker_build_push: - if: github.ref == 'refs/heads/main' - needs: build_and_test - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Determine Docker tags - id: docker_tags - run: | - IMAGE=mcdanieles/lumenlab - echo "LATEST_TAG=latest" >> $GITHUB_ENV - VERSION_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") - echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV - echo "IMAGE=$IMAGE" >> $GITHUB_ENV - echo "Tags: latest=${LATEST_TAG}, version=${VERSION_TAG}" - - - name: Build Docker image - run: | - docker build -t $IMAGE:$LATEST_TAG${VERSION_TAG:+ -t $IMAGE:$VERSION_TAG} . + - name: Build LumenLab + run: pio run - - name: Push Docker image - run: | - docker push $IMAGE:$LATEST_TAG - if [[ -n "$VERSION_TAG" ]]; then - docker push $IMAGE:$VERSION_TAG - fi + - name: Run tests + run: pio test --environment native \ No newline at end of file From c8ff557efb426f02e2dfedd69bd3ee61105509d7 Mon Sep 17 00:00:00 2001 From: Eric McDaniel Date: Fri, 13 Feb 2026 17:52:30 -0600 Subject: [PATCH 2/2] Add stages for build, test, and deployment --- .github/workflows/build-ci.yaml | 109 ++++++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-ci.yaml b/.github/workflows/build-ci.yaml index edd5413..aa44ecf 100644 --- a/.github/workflows/build-ci.yaml +++ b/.github/workflows/build-ci.yaml @@ -7,20 +7,32 @@ on: branches: - main +permissions: + contents: write + jobs: - build_and_test: + pr_build_and_test: + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cache pip and PlatformIO + uses: actions/cache@v4 with: path: | ~/.cache/pip ~/.platformio/.cache key: ${{ runner.os }}-pio - - uses: actions/setup-python@v5 + + - name: Setup Python + uses: actions/setup-python@v5 with: python-version: '3.11' + - name: Inject credentials run: python3 ${{ github.workspace }}/tools/setup_dev_env.py @@ -31,4 +43,91 @@ jobs: run: pio run - name: Run tests - run: pio test --environment native \ No newline at end of file + run: pio test --environment native + + release_on_main: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: [] + steps: + - name: Checkout (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cache pip and PlatformIO + uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Inject credentials + run: python3 ${{ github.workspace }}/tools/setup_dev_env.py + + - name: Install platformio core libraries + run: pip install --upgrade platformio + + - name: Build release + run: pio run -e release + + - name: Run tests + run: pio test --environment native + + - name: Create and push tag for release + id: tag_release + run: | + git fetch --tags + latest_tag=$(git tag --list --sort=-v:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | head -n1 || true) + if [ -z "$latest_tag" ]; then + new_tag=v0.0.1 + else + t=${latest_tag#v} + IFS='.' read -r major minor patch <<< "$t" + patch=$((patch+1)) + new_tag="v${major}.${minor}.${patch}" + fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag -a "$new_tag" -m "Release $new_tag" + git push origin "$new_tag" + echo "tag=$new_tag" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + with: + tag_name: ${{ steps.tag_release.outputs.tag }} + release_name: Release ${{ steps.tag_release.outputs.tag }} + draft: false + prerelease: false + + - name: Upload firmware.bin + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .pio/build/release/firmware.bin + asset_name: firmware.bin + asset_content_type: application/octet-stream + + - name: Upload bootloader.bin + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .pio/build/release/bootloader.bin + asset_name: bootloader.bin + asset_content_type: application/octet-stream + + - name: Upload partitions.bin + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .pio/build/release/partitions.bin + asset_name: partitions.bin + asset_content_type: application/octet-stream \ No newline at end of file