From 32f70e5f3703a0a66abb80401a17686a0f5dba37 Mon Sep 17 00:00:00 2001 From: Mathieu Carbou Date: Thu, 1 Feb 2024 04:17:44 +0100 Subject: [PATCH] Fix CI --- .github/workflows/build.yml | 57 ++++++++--------------------------- .github/workflows/website.yml | 4 +-- README.md | 2 +- platformio.ini | 4 ++- 4 files changed, 18 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5cdbfc2..8848a8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,42 +4,10 @@ name: Build on: workflow_dispatch: - # schedule: - # - cron: "0 1 * * *" + pull_request: push: - branches: [ - "main", - "dev", - "*" - ] + branches: ["*"] tags: ["v*"] - paths-ignore: - [ - "docs/**", - "**/*.md", - "site/**", - "**/portal/**", - "tools/**", - "test/**", - ".github/workflows/website.yml", - ".github/workflows/dependabot.yml", - ".github/dependabot.yml", - ".github/FUNDING.yml", - ] - pull_request: - paths-ignore: - [ - "docs/**", - "**/*.md", - "site/**", - "**/portal/**", - "tools/**", - "test/**", - ".github/workflows/website.yml", - ".github/workflows/dependabot.yml", - ".github/dependabot.yml", - ".github/FUNDING.yml", - ] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -103,12 +71,17 @@ jobs: python -m pip install --upgrade pip pip install --upgrade platformio - - name: Get Envs + - name: Get Pro Envs id: envs run: | + repo="${{ github.repository }}" rm -f platformio_override.ini echo "pio_name=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT - echo "pio_default_envs=$(pio project config --json-output | jq -cr '.[0][1][1][1]')" >> $GITHUB_OUTPUT + if [[ "$repo" == "mathieucarbou/YaSolR" ]]; then + echo "pio_default_envs=$(pio project config --json-output | jq -cr '.[0][1][2][1]|split(",")')" >> $GITHUB_OUTPUT + else + echo "pio_default_envs=$(pio project config --json-output | jq -cr '.[0][1][3][1]|split(",")')" >> $GITHUB_OUTPUT + fi outputs: pio_name: ${{ steps.envs.outputs.pio_name }} @@ -123,11 +96,9 @@ jobs: environment: ${{ fromJSON(needs.pio_envs.outputs.pio_default_envs) }} steps: - name: Checkout - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/checkout@v4 - name: Get Tags - if: ${{ github.repository == 'mathieucarbou/YaSolR' }} run: git fetch --force --tags origin - name: Remove Pro Content @@ -143,13 +114,12 @@ jobs: make-oss.sh - name: Remove OSS Content - if: ${{ startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} + if: ${{ startsWith(matrix.environment, 'pro-') }} run: | rm -f -r -v \ lib/ESPDASH - name: Cache PlatformIO - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/cache@v4 with: key: ${{ runner.os }}-pio @@ -165,20 +135,18 @@ jobs: path: .pio/libdeps - name: Cache YaSolR Pro - if: ${{ startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} + if: ${{ startsWith(matrix.environment, 'pro-') }} uses: actions/cache@v4 with: key: ${{ runner.os }}-YaSolR-pro path: .pio/libdeps - name: Python - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/setup-python@v5 with: python-version: "3.x" - name: Build - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} run: | python -m pip install --upgrade pip pip install --upgrade platformio @@ -189,7 +157,6 @@ jobs: mv .pio/build/${{ matrix.environment }}/firmware.factory.bin ./${{ needs.pio_envs.outputs.pio_name }}-$ref-${{ matrix.environment }}.factory.bin - name: Upload - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/upload-artifact@v4 with: name: ${{ matrix.environment }} @@ -199,7 +166,7 @@ jobs: release: name: Release - if: ${{ github.repository == 'mathieucarbou/YaSolR' && github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} + if: ${{ github.repository_owner == 'mathieucarbou' && github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} runs-on: ubuntu-latest needs: [cpplint, YaSolR] permissions: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 9bfaa93..6953aa8 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -28,7 +28,7 @@ jobs: source: ./site destination: ./site/_site - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 with: path: ./site/_site @@ -46,4 +46,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v3 + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 26d2a57..e04cd31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![YaS☀️lR (Yet another Solar Router)](./site/assets/img/logo.png?raw=1)](https://yasolr.carbou.me/) +[![YaS☀️lR (Yet another Solar Router)](https://yasolr.carbou.me/assets/img/logo.png)](https://yasolr.carbou.me/) [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html) [![Download](https://img.shields.io/badge/Download-bin-green.svg)](https://yasolr.carbou.me/download) diff --git a/platformio.ini b/platformio.ini index 31a0b09..0b92766 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,7 +10,9 @@ [platformio] name = YaSolR -default_envs = pro-esp32, pro-esp32-debug, pro-esp32s, pro-esp32s-debug, oss-esp32 +default_envs = pro-esp32, pro-esp32-debug, pro-esp32s, pro-esp32s-debug, oss-esp32, oss-esp32-debug, oss-esp32s, oss-esp32s-debug +pro_envs = pro-esp32,pro-esp32-debug,oss-esp32 +oss_envs = oss-esp32,oss-esp32-debug,oss-esp32s,oss-esp32s-debug extra_configs = platformio_override.ini [env]