forked from espressif/esp32-arduino-lib-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
380 additions
and
261 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,36 @@ | ||
name: Cron Build | ||
name: Cron Deploy | ||
|
||
on: | ||
on: | ||
schedule: | ||
# ┌───────────── minute (0 - 59) | ||
# │ ┌───────────── hour (0 - 23) | ||
# │ │ ┌───────────── day of the month (1 - 31) | ||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | ||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# * * * * * | ||
- cron: '0 */6 * * *' | ||
workflow_dispatch: # For testing | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
run: | ||
build-libs: | ||
name: Build with IDF ${{ matrix.idf_branch }} | ||
runs-on: ubuntu-latest | ||
|
||
uses: ./.github/workflows/cron_build.yml | ||
with: | ||
idf_branch: ${{ matrix.idf_branch }} | ||
lib_builder_branch: ${{ matrix.lib_builder_branch }} | ||
targets: ${{ matrix.targets }} | ||
secrets: inherit | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
idf_branch: [release/v5.1, release/v4.4] #, release/v3.3] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install dependencies | ||
run: bash ./tools/prepare-ci.sh | ||
- name: Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | ||
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
IDF_BRANCH: ${{ matrix.idf_branch }} | ||
run: | | ||
git checkout ${{ matrix.idf_branch }} || echo "Using master branch" | ||
bash ./tools/cron.sh | ||
- name: Upload build | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build | ||
path: build | ||
- name: Upload archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: dist | ||
|
||
|
||
# check: | ||
# name: Check if result should be deployed | ||
# runs-on: ubuntu-latest | ||
# strategy: | ||
# matrix: | ||
# branch: [release/v5.1, release/v4.4] #, release/v3.3] | ||
# outputs: | ||
# idf_branch: ${{ steps.check.outputs.idf_branch }} | ||
# idf_commit: ${{ steps.check.outputs.idf_commit }} | ||
# ar_branch: ${{ steps.check.outputs.ar_branch }} | ||
# ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }} | ||
# ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }} | ||
# ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }} | ||
# ar_has_commit: ${{ steps.check.outputs.ar_has_commit }} | ||
# ar_has_branch: ${{ steps.check.outputs.ar_has_branch }} | ||
# ar_has_pr: ${{ steps.check.outputs.ar_has_pr }} | ||
# libs_version: ${{ steps.check.outputs.libs_version }} | ||
# libs_has_commit: ${{ steps.check.outputs.libs_has_commit }} | ||
# libs_has_branch: ${{ steps.check.outputs.libs_has_branch }} | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - id: check | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | ||
# GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
# GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
# IDF_BRANCH: ${{ matrix.idf_branch }} | ||
# run: bash ./tools/check-deploy-needed.sh | ||
|
||
# build: | ||
# name: Build Libs for ${{ matrix.target }} | ||
# runs-on: ubuntu-latest | ||
# needs: check | ||
# if: needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0' | ||
# strategy: | ||
# matrix: | ||
# target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2] | ||
# fail-fast: false | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# # - name: Install dependencies | ||
# # run: bash ./tools/prepare-ci.sh | ||
# - shell: bash | ||
# name: Build Libs for ${{ matrix.target }} | ||
# run: echo ${{ matrix.target }} | ||
# # run: bash ./build.sh -t ${{ matrix.target }} | ||
# # - name: Upload archive | ||
# # uses: actions/upload-artifact@v3 | ||
# # with: | ||
# # name: artifacts | ||
# # path: dist | ||
|
||
# deploy: | ||
# name: Deploy build | ||
# runs-on: ubuntu-latest | ||
# needs: [check, build] | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - shell: bash | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} | ||
# GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
# GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} | ||
# IDF_BRANCH: ${{ needs.check.outputs.idf_branch }} | ||
# IDF_COMMIT: ${{ needs.check.outputs.idf_commit }} | ||
# AR_BRANCH: ${{ needs.check.outputs.ar_branch }} | ||
# AR_NEW_COMMIT_MESSAGE: ${{ needs.check.outputs.ar_new_commit_message }} | ||
# AR_NEW_BRANCH_NAME: ${{ needs.check.outputs.ar_new_branch_name }} | ||
# AR_NEW_PR_TITLE: ${{ needs.check.outputs.ar_new_pr_title }} | ||
# AR_HAS_COMMIT: ${{ needs.check.outputs.ar_has_commit }} | ||
# AR_HAS_BRANCH: ${{ needs.check.outputs.ar_has_branch }} | ||
# AR_HAS_PR: ${{ needs.check.outputs.ar_has_pr }} | ||
# LIBS_VERSION: ${{ needs.check.outputs.libs_version }} | ||
# LIBS_HAS_COMMIT: ${{ needs.check.outputs.libs_has_commit }} | ||
# LIBS_HAS_BRANCH: ${{ needs.check.outputs.libs_has_branch }} | ||
# run: | | ||
# echo "IDF_COMMIT: $IDF_COMMIT" | ||
# echo "AR_BRANCH: $AR_BRANCH" | ||
# echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE" | ||
# echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME" | ||
# echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE" | ||
# echo "AR_HAS_COMMIT: $AR_HAS_COMMIT" | ||
# echo "AR_HAS_BRANCH: $AR_HAS_BRANCH" | ||
# echo "AR_HAS_PR: $AR_HAS_PR" | ||
# echo "LIBS_VERSION: $LIBS_VERSION" | ||
# echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT" | ||
# echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH" | ||
|
||
include: | ||
- idf_branch: "release/v5.1" | ||
lib_builder_branch: "master" | ||
targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2" |
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,168 @@ | ||
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: | ||
idf_commit: ${{ steps.check.outputs.idf_commit }} | ||
ar_branch: ${{ steps.check.outputs.ar_branch }} | ||
ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }} | ||
ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }} | ||
ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }} | ||
ar_has_commit: ${{ steps.check.outputs.ar_has_commit }} | ||
ar_has_branch: ${{ steps.check.outputs.ar_has_branch }} | ||
ar_has_pr: ${{ steps.check.outputs.ar_has_pr }} | ||
libs_release_tag: ${{ steps.check.outputs.libs_release_tag }} | ||
libs_version: ${{ steps.check.outputs.libs_version }} | ||
libs_release_id: ${{ steps.check.outputs.libs_release_id }} | ||
libs_has_release: ${{ steps.check.outputs.libs_has_release }} | ||
libs_asset_id: ${{ steps.check.outputs.libs_asset_id }} | ||
libs_has_asset: ${{ steps.check.outputs.libs_has_asset }} | ||
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 "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.libs_has_asset == '0' | ||
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 and push changes for IDF ${{ inputs.idf_branch }} | ||
runs-on: ubuntu-latest | ||
needs: [check-if-needed, build-libs] | ||
if: | | ||
always() && | ||
needs.check-if-needed.result == 'success' && | ||
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 | ||
if: needs.check-if-needed.outputs.libs_has_asset == '0' | ||
run: | | ||
branch=${{ inputs.idf_branch }} | ||
echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV | ||
- name: Download artifacts | ||
if: needs.check-if-needed.outputs.libs_has_asset == '0' | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
pattern: libs-${{ env.libs_branch }}-* | ||
merge-multiple: true | ||
|
||
- name: Combine artifacts | ||
if: needs.check-if-needed.outputs.libs_has_asset == '0' | ||
run: bash ./tools/combine-artifacts.sh | ||
|
||
- name: Upload full esp32-arduino-libs archive | ||
if: needs.check-if-needed.outputs.libs_has_asset == '0' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: esp32-arduino-libs-${{ env.libs_branch }} | ||
path: dist/esp32-arduino-libs.zip | ||
compression-level: 0 | ||
|
||
- 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 }} | ||
IDF_COMMIT: ${{ needs.check-if-needed.outputs.idf_commit }} | ||
AR_BRANCH: ${{ needs.check-if-needed.outputs.ar_branch }} | ||
AR_NEW_COMMIT_MESSAGE: ${{ needs.check-if-needed.outputs.ar_new_commit_message }} | ||
AR_NEW_BRANCH_NAME: ${{ needs.check-if-needed.outputs.ar_new_branch_name }} | ||
AR_NEW_PR_TITLE: ${{ needs.check-if-needed.outputs.ar_new_pr_title }} | ||
AR_HAS_COMMIT: ${{ needs.check-if-needed.outputs.ar_has_commit }} | ||
AR_HAS_BRANCH: ${{ needs.check-if-needed.outputs.ar_has_branch }} | ||
AR_HAS_PR: ${{ needs.check-if-needed.outputs.ar_has_pr }} | ||
LIBS_RELEASE_TAG: ${{ needs.check-if-needed.outputs.libs_release_tag }} | ||
LIBS_VERSION: ${{ needs.check-if-needed.outputs.libs_version }} | ||
LIBS_RELEASE_ID: ${{ needs.check-if-needed.outputs.libs_release_id }} | ||
LIBS_HAS_RELEASE: ${{ needs.check-if-needed.outputs.libs_has_release }} | ||
LIBS_ASSET_ID: ${{ needs.check-if-needed.outputs.libs_asset_id }} | ||
LIBS_HAS_ASSET: ${{ needs.check-if-needed.outputs.libs_has_asset }} | ||
run: | | ||
bash ./tools/push-to-arduino.sh | ||
- name: Upload package_esp32_index.template.json | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: package-esp32-index-json-${{ env.libs_branch }} | ||
path: out/package_esp32_index.template.json |
Oops, something went wrong.