-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18e877b
commit 26ff50a
Showing
4 changed files
with
164 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: Cron Build Matrix | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
idf_branch: | ||
type: string | ||
required: true | ||
description: 'IDF branch to build' | ||
lib_builder_branch: | ||
type: string | ||
required: true | ||
description: 'Branch of the lib-builder to use' | ||
targets: | ||
type: string | ||
required: true | ||
description: 'Targets to build' | ||
|
||
env: | ||
IDF_BRANCH: ${{ inputs.idf_branch }} | ||
|
||
jobs: | ||
check-if-needed: | ||
name: Check if deploy is needed for ${{ inputs.idf_branch }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
deploy_needed: ${{ steps.check.outputs.deploy_needed }} | ||
targets_list: ${{ steps.check.outputs.targets_list }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.lib_builder_branch }} | ||
|
||
- name: Check deploy and generate variables | ||
id: check | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
source ./tools/check-deploy-needed.sh | ||
targets_list=$(echo "${{ inputs.targets }}" | sed 's/ *, */,/g' | sed 's/^/["/' | sed 's/$/"]/' | sed 's/,/","/g') | ||
echo "Targets list: $targets_list" | ||
echo "deploy_needed=$DEPLOY_NEEDED" >> $GITHUB_OUTPUT | ||
echo "targets_list=$targets_list" >> $GITHUB_OUTPUT | ||
build-libs: | ||
name: Build for ${{ matrix.target }} (${{ inputs.idf_branch }}) | ||
runs-on: ubuntu-latest | ||
if: needs.check-if-needed.outputs.deploy_needed == '1' | ||
needs: check-if-needed | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: ${{ fromJson(needs.check-if-needed.outputs.targets_list) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.lib_builder_branch }} | ||
|
||
- name: Install dependencies | ||
run: bash ./tools/prepare-ci.sh | ||
|
||
- name: Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN || secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
TARGET: ${{ matrix.target }} | ||
run: | | ||
bash ./tools/cron.sh | ||
- name: Replace invalid characters in the artifact name | ||
run: | | ||
branch=${{ inputs.idf_branch }} | ||
echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV | ||
- name: Upload build | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-${{ env.libs_branch }}-${{ matrix.target }} | ||
path: build | ||
|
||
- name: Upload library files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libs-${{ env.libs_branch }}-${{ matrix.target }} | ||
path: dist | ||
|
||
combine-artifacts: | ||
name: Combine artifacts for IDF ${{ inputs.idf_branch }} | ||
runs-on: ubuntu-latest | ||
needs: [check-if-needed, build-libs] | ||
if: needs.check-if-needed.outputs.deploy_needed == '1' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.lib_builder_branch }} | ||
|
||
- name: Replace invalid characters in the artifact name | ||
run: | | ||
branch=${{ inputs.idf_branch }} | ||
echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
pattern: libs-${{ env.libs_branch }}-* | ||
merge-multiple: true | ||
|
||
- name: Combine artifacts | ||
run: bash ./tools/combine-artifacts.sh | ||
|
||
- name: Upload full esp32-arduino-libs archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: esp32-arduino-libs-${{ env.libs_branch }} | ||
path: dist/esp32-arduino-libs.tar.gz | ||
|
||
- name: Upload package_esp32_index.template.json | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: package-esp32-index-json-${{ env.libs_branch }} | ||
path: dist/package_esp32_index.template.json | ||
|
||
- name: Push changes | ||
if: github.repository == 'espressif/esp32-arduino-lib-builder' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | ||
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
run: | | ||
bash ./tools/push-to-arduino.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
mkdir -p out | ||
|
||
libs_folder="out/tools/esp32-arduino-libs" | ||
|
||
files=$(find dist -name 'arduino-esp32-libs-esp*.tar.gz') | ||
for file in $files; do | ||
echo "Extracting $file" | ||
tar zxvf $file -C out | ||
cat $libs_folder/versions.txt >> $libs_folder/versions_full.txt | ||
done | ||
|
||
# Merge versions.txt files | ||
awk -i inplace '!seen[$0]++' $libs_folder/versions_full.txt | ||
mv -f $libs_folder/versions_full.txt $libs_folder/versions.txt | ||
|
||
cd $libs_folder && tar zcf ../../../dist/esp32-arduino-libs.tar.gz * && cd ../../.. | ||
cp out/package_esp32_index.template.json dist/package_esp32_index.template.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters