From b783dc4de248de139cb80c69cd82268dfee7e27e Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Wed, 17 Aug 2022 15:10:51 +0200 Subject: [PATCH 1/4] Update Github actions for environment compilation --- .github/workflows/build.yml | 118 +++++++++++++++++++++----------- .github/workflows/dev-build.yml | 63 ----------------- 2 files changed, 79 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/dev-build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38f046f..222f34e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,28 +2,27 @@ name: Build on: push: - branches: - - master -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - include: - - os: windows-latest - pio_lib_path: D:\a\Luos - - os: macos-latest - pio_lib_path: ~/work/Luos - - os: ubuntu-latest - pio_lib_path: ~/work/Luos +concurrency: + group: dev-build-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +defaults: + run: + shell: bash +jobs: + code-format: + name: Code format + runs-on: ubuntu-latest steps: + - name: Check out Luos repository + uses: actions/checkout@v3 + - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.10.5" - name: Set up Node uses: actions/setup-node@v2 @@ -31,33 +30,74 @@ jobs: node-version: "14" - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install platformio - npm install -g clang-format@1.5.0 - - - name: Check out getting started repository - uses: actions/checkout@v2 + run: npm install -g clang-format@1.5.0 - name: Check for code format - if: ${{ runner.os != 'Windows' }} run: python .github/workflows/run-clang-format.py -r . - - name: Create env repo - shell: bash + get-started-build: + name: Get started build + runs-on: ${{ matrix.os }} + strategy: + matrix: + project_folders: + [ + Arduino, + NUCLEO-F072RB, + NUCLEO-F401RE, + NUCLEO-F410RB, + NUCLEO-G431KB, + NUCLEO-L432KC, + ] + os: [macos-latest, windows-latest, ubuntu-latest] + + steps: + - name: Check out Luos repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10.5" + + - name: Install dependencies run: | - # Save branch name - branch_name=$(git branch --show-current) - origine_branch_name="origin/${branch_name}" - echo current branch name is ${branch_name} + python -m pip install --upgrade pip + pip install wheel + pip install platformio - name: Run PlatformIO - env: - PLATFORMIO_LIB_EXTRA_DIRS: ${{ matrix.pio_lib_path }} run: | - platformio run -d Arduino - platformio run -d NUCLEO-F072RB - platformio run -d NUCLEO-F401RE - platformio run -d NUCLEO-F410RB - platformio run -d NUCLEO-G431KB - platformio run -d NUCLEO-L432KC + for d in ${{ matrix.project_folders }}/*/ + do + # Parse all folder + if [ -f "$d/platformio.ini" ] + then + # This is a PIO project compile it for all envs + for e in $(pio project config |grep "env:"|cut -c5-) + do + echo "Platform : $e" + echo "Compiling : $d" + pio run d $d -e $e & + done + else + # This folder could contain other projects, continue digging + for dd in $d*/ + do + # Parse all folder + if [ -f "$dd/platformio.ini" ] + then + # This is a PIO project compile it + echo "Compiling : $d" + platformio run -d $dd + fi + done + fi + done + + build-success: + name: Build success + needs: get-started-build + runs-on: ubuntu-latest + steps: + - run: echo "Build succeed!" diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml deleted file mode 100644 index 54c3aaa..0000000 --- a/.github/workflows/dev-build.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Dev Build - -on: - push: - branches-ignore: - - master - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - include: - - os: windows-latest - pio_lib_path: D:\a\Luos - - os: macos-latest - pio_lib_path: ~/work/Luos - - os: ubuntu-latest - pio_lib_path: ~/work/Luos - - steps: - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: "3.x" - - - name: Set up Node - uses: actions/setup-node@v2 - with: - node-version: "14" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install platformio - npm install -g clang-format@1.5.0 - - - name: Check out getting started repository - uses: actions/checkout@v2 - - - name: Check for code format - if: ${{ runner.os != 'Windows' }} - run: python .github/workflows/run-clang-format.py -r . - - - name: Create env repo - shell: bash - run: | - # Save branch name - branch_name=$(git branch --show-current) - origine_branch_name="origin/${branch_name}" - echo current branch name is ${branch_name} - - - name: Run PlatformIO - env: - PLATFORMIO_LIB_EXTRA_DIRS: ${{ matrix.pio_lib_path }} - run: | - platformio run -d Arduino - platformio run -d NUCLEO-F072RB - platformio run -d NUCLEO-F401RE - platformio run -d NUCLEO-F410RB - platformio run -d NUCLEO-G431KB - platformio run -d NUCLEO-L432KC From becb5bc4db6e7199b7e450a1ed779b4cc2d12690 Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Wed, 17 Aug 2022 18:01:24 +0200 Subject: [PATCH 2/4] Fix action --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 222f34e..4f49c3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,9 +62,10 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install wheel - pip install platformio + # Save branch name + branch_name=$(git branch --show-current) + origine_branch_name="origin/${branch_name}" + echo current branch name is ${branch_name} - name: Run PlatformIO run: | From 47ce05f5632e002ed5bcba2f9579521df52a0a08 Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Wed, 17 Aug 2022 18:18:45 +0200 Subject: [PATCH 3/4] add multi env --- .github/workflows/build.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f49c3f..ee2da88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,18 +69,20 @@ jobs: - name: Run PlatformIO run: | + rootPath=$(pwd) for d in ${{ matrix.project_folders }}/*/ do # Parse all folder if [ -f "$d/platformio.ini" ] then + cd $d # This is a PIO project compile it for all envs - for e in $(pio project config |grep "env:"|cut -c5-) + for e in $(pio project config | grep "env:" | cut -c5-) do - echo "Platform : $e" - echo "Compiling : $d" - pio run d $d -e $e & + echo "Compiling $d in env $e" + platformio run -d "$rootPath/$d" -e $e done + cd $rootPath else # This folder could contain other projects, continue digging for dd in $d*/ @@ -88,9 +90,14 @@ jobs: # Parse all folder if [ -f "$dd/platformio.ini" ] then + cd $dd # This is a PIO project compile it - echo "Compiling : $d" - platformio run -d $dd + for e in $(pio project config | grep "env:" | cut -c5-) + do + echo "Compiling $dd in env $e" + platformio run -d "$rootPath/$dd" -e $e + done + cd $rootPath fi done fi From 8ca516364886f72dde8fb582865de0afcd6e0d5e Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Thu, 1 Sep 2022 16:07:37 +0200 Subject: [PATCH 4/4] Add ESP32 to CI job --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee2da88..34e1b4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,7 @@ jobs: project_folders: [ Arduino, + ESP32-DevKit, NUCLEO-F072RB, NUCLEO-F401RE, NUCLEO-F410RB,