Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache IDF and tools for esp32 CI builds #2848

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/ci-esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
13 changes: 9 additions & 4 deletions Sming/Arch/Esp32/Tools/install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions Sming/Arch/Esp32/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions Tools/ci/setenv.ps1
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down
Loading