diff --git a/.github/workflows/ci-esp32.yml b/.github/workflows/ci-esp32.yml index d0dda46259..90761f6979 100644 --- a/.github/workflows/ci-esp32.yml +++ b/.github/workflows/ci-esp32.yml @@ -32,7 +32,7 @@ jobs: - os: windows-latest idf_version: "5.0" - concurrency: + concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ toJson(matrix) }} cancel-in-progress: true @@ -62,8 +62,26 @@ jobs: "CI_BUILD_DIR=" + (Resolve-Path ".").path >> $env:GITHUB_ENV "SMING_HOME=" + (Resolve-Path "Sming").path >> $env:GITHUB_ENV + - name: Fix permissions + if: ${{ matrix.os != 'windows-latest' }} + run: | + sudo chown $USER /opt + + - name: Cache ESP-IDF + uses: actions/cache@v4 + with: + path: /opt/esp-idf-${{ matrix.idf_version }} + key: idf-${{ matrix.idf_version }} + enableCrossOsArchive: true + + - name: Cache build tools + uses: actions/cache@v4 + with: + path: /opt/esp32 + key: ${{ matrix.os }}-esp32-${{ matrix.idf_version }} + - name: Install build tools for Ubuntu - if: ${{ matrix.os == 'ubuntu-latest' }} + if: ${{ matrix.os == 'ubuntu-latest' }} run: | Tools/ci/install.sh diff --git a/Sming/Arch/Esp32/Tools/install.cmd b/Sming/Arch/Esp32/Tools/install.cmd index 8e758a62de..fec3dce891 100644 --- a/Sming/Arch/Esp32/Tools/install.cmd +++ b/Sming/Arch/Esp32/Tools/install.cmd @@ -3,18 +3,23 @@ REM Esp32 install.cmd if "%IDF_PATH%"=="" goto :EOF if "%IDF_TOOLS_PATH%"=="" goto :EOF +if exist "%IDF_PATH%" goto :setup + if "%IDF_REPO%"=="" set IDF_REPO="https://github.com/mikee47/esp-idf.git" if "%INSTALL_IDF_VER%"=="" set INSTALL_IDF_VER=5.2 set IDF_BRANCH="sming/release/v%INSTALL_IDF_VER%" -git clone -b %IDF_BRANCH% %IDF_REPO% %IDF_PATH% +if "%CI_BUILD_DIR%" NEQ "" ( + set IDF_INSTALL_OPTIONS=--depth 1 --recurse-submodules --shallow-submodules +) +git clone -b %IDF_BRANCH% %IDF_REPO% %IDF_PATH% %IDF_INSTALL_OPTIONS% + +:setup REM Install IDF tools and packages python "%IDF_PATH%\tools\idf_tools.py" --non-interactive install python -m pip install %SMINGTOOLS%/gevent-1.5.0-cp39-cp39-win_amd64.whl -set IDF_REQUIREMENTS="%IDF_PATH%\requirements.txt" -if not exist "%IDF_REQUIREMENTS%" set IDF_REQUIREMENTS="%IDF_PATH%\tools\requirements\requirements.core.txt" -python -m pip install -r "%IDF_REQUIREMENTS%" +python3 "%IDF_PATH%\tools\idf_tools.py" --non-interactive install-python-env if "%INSTALL_IDF_VER%" == "5.0" goto :install_python if "%INSTALL_IDF_VER%" == "5.2" goto :install_python diff --git a/Sming/Arch/Esp32/Tools/install.sh b/Sming/Arch/Esp32/Tools/install.sh index 20c1fae9ed..fa191f34ad 100755 --- a/Sming/Arch/Esp32/Tools/install.sh +++ b/Sming/Arch/Esp32/Tools/install.sh @@ -44,20 +44,22 @@ if [ ! -L "$IDF_PATH" ] && [ -d "$IDF_PATH" ]; then fi INSTALL_IDF_VER="${INSTALL_IDF_VER:=5.2}" -IDF_CLONE_PATH="$IDF_PATH/../esp-idf-${INSTALL_IDF_VER}" +IDF_CLONE_PATH="$(dirname "$IDF_PATH")/esp-idf-${INSTALL_IDF_VER}" IDF_REPO="${IDF_REPO:=https://github.com/mikee47/esp-idf.git}" IDF_BRANCH="sming/release/v${INSTALL_IDF_VER}" if [ -d "$IDF_CLONE_PATH" ]; then printf "\n\n** Skipping ESP-IDF clone: '%s' exists\n\n" "$IDF_CLONE_PATH" else + if [ -n "$CI_BUILD_DIR" ]; then + IDF_INSTALL_OPTIONS="--depth 1 --recurse-submodules --shallow-submodules" + fi echo "git clone -b $IDF_BRANCH $IDF_REPO $IDF_CLONE_PATH" - git clone -b "$IDF_BRANCH" "$IDF_REPO" "$IDF_CLONE_PATH" + git clone -b "$IDF_BRANCH" "$IDF_REPO" "$IDF_CLONE_PATH" $IDF_INSTALL_OPTIONS fi -IDF_CLONE_PATH=$(realpath "$IDF_CLONE_PATH") # Create link to clone -rm -rf "$IDF_PATH" +rm -f "$IDF_PATH" ln -s "$IDF_CLONE_PATH" "$IDF_PATH" # Install IDF tools and packages diff --git a/Tools/ci/setenv.ps1 b/Tools/ci/setenv.ps1 index 17b6cbf472..fb6837868d 100644 --- a/Tools/ci/setenv.ps1 +++ b/Tools/ci/setenv.ps1 @@ -1,9 +1,4 @@ -if($IsWindows) { - $TOOLS_DIR = "C:\tools" -} else { - $TOOLS_DIR = "/opt" - sudo chown appveyor:appveyor /opt -} +$TOOLS_DIR = "D:/opt" $env:CI_BUILD_DIR = (Resolve-Path "$PSScriptRoot/../..").Path $env:SMING_HOME = Join-Path $env:CI_BUILD_DIR "Sming" @@ -12,7 +7,7 @@ $env:SMING_HOME = Join-Path $env:CI_BUILD_DIR "Sming" $env:ESP_HOME = Join-Path $TOOLS_DIR "esp-quick-toolchain" # Esp32 -$env:IDF_PATH = Join-Path $TOOLS_DIR "esp-idf" +$env:IDF_PATH = Join-Path $TOOLS_DIR "esp-idf-$env:INSTALL_IDF_VER" $env:IDF_TOOLS_PATH = Join-Path $TOOLS_DIR "esp32" # Rp2040