Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Feb 1, 2024
1 parent 84ca52d commit 1862ce6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 47 deletions.
57 changes: 13 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -103,12 +71,18 @@ jobs:
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Get Envs
- name: Get Pro Envs
if: ${{ github.repository == 'mathieucarbou/YaSolR' }}
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 }}
Expand All @@ -123,7 +97,6 @@ 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
Expand All @@ -143,13 +116,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
Expand All @@ -165,20 +137,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
Expand All @@ -189,7 +159,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 }}
Expand All @@ -199,7 +168,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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -46,4 +46,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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,pro-esp32s,pro-esp32s-debug,oss-esp32
oss__envs = oss-esp32,oss-esp32-debug,oss-esp32s,oss-esp32s-debug
extra_configs = platformio_override.ini

[env]
Expand Down

0 comments on commit 1862ce6

Please sign in to comment.