From 27d3420ad7e81fb78e30f3833579b02d37a12e2b Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 22 Jan 2025 09:31:51 +0000 Subject: [PATCH] Build each usermod in isolation --- .github/workflows/usermods.yml | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/usermods.yml diff --git a/.github/workflows/usermods.yml b/.github/workflows/usermods.yml new file mode 100644 index 000000000..58973e956 --- /dev/null +++ b/.github/workflows/usermods.yml @@ -0,0 +1,70 @@ +name: Usermod CI + +on: + push: +# paths: +# - usermods/** + +jobs: + + get_usermod_envs: + name: Gather Environments + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + - name: Install PlatformIO + run: pip install -r requirements.txt + - name: Get default environments + id: envs + run: | + echo -n "usermods=\"" >> $GITHUB_OUTPUT + find usermods/ -name library.json | xargs dirname | xargs -n 1 basename | xargs echo >> $GITHUB_OUTPUT + echo "\"" >> $GITHUB_OUTPUT + outputs: + usermods: ${{ steps.envs.outputs.usermods }} + + + build: + name: Build Enviornments + runs-on: ubuntu-latest + needs: get_usermod_envs + strategy: + fail-fast: false + matrix: + environment: [usermod] + usermod: ${{ needs.get_usermod_envs.outputs.usermods }} + steps: + - uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - run: npm ci + - name: Cache PlatformIO + uses: actions/cache@v4 + with: + path: | + ~/.platformio/.cache + ~/.buildcache + build_output + key: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-${{ hashFiles('wled00/**', 'usermods/**') }} + restore-keys: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}- + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + - name: Install PlatformIO + run: pip install -r requirements.txt + - name: Add usermods environment + run: | + cp -v usermods/platformio_override.usermods.ini platformio_override.ini + echo -n "custom_usermods = ${{ matrix.usermod }}" >> platformio_override.ini + + - name: Build firmware + run: pio run -e ${{ matrix.environment }}