Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Test

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio
.pio
key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-pio-

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio

- name: Build firmware
run: pio run
working-directory: ${{ github.workspace }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: firmware
path: .pio/build/megaatmega2560/firmware.hex
retention-days: 7
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pre-commit Build Check

on:
- pre-commit

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio

- name: Build firmware
run: pio run
48 changes: 48 additions & 0 deletions BUILD_TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# LED Controller - Build Testing

This repository includes automated build testing on every commit.

## Automated Build Testing

### GitHub Actions (CI/CD)

- **Trigger**: Runs on every push and pull request to any branch
- **Location**: `.github/workflows/build.yml`
- **What it does**:
- Checks out code
- Sets up PlatformIO environment
- Builds firmware for `megaatmega2560` target
- Uploads firmware artifact (`.hex` file)
- Caches dependencies for faster builds

### Local Pre-commit Hook

- **Trigger**: Runs automatically before each git commit
- **Location**: `.git/hooks/pre-commit`
- **What it does**:
- Runs `pio run` to build the project
- Blocks commit if build fails
- Allows commit to proceed if build succeeds

## Build Status

Check the **Actions** tab on GitHub to see build status for all commits.

## Manual Testing

To manually test the build:

```bash
pio run
```

To skip the pre-commit hook (not recommended):

```bash
git commit --no-verify
```

## Requirements

- PlatformIO Core installed locally for pre-commit hooks
- GitHub Actions handles CI builds automatically (no local setup needed)