diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 69070cea4..78ee985dd 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,19 +16,17 @@ name: Docker Image CI on: push: - # Runs when chip-builds file changes branches: [ "main" ] - paths: - - "tools/docker/chip-builds" # Can be run manually workflow_dispatch: env: # Platforms to build the image for - BUILD_PLATFORMS: linux/amd64,linux/arm64 + # Github runner is running out of space when we are building for multiple architectures in single runner + BUILD_PLATFORMS: linux/amd64 DOCKERHUB_REPO: ${{ github.repository }} - TAG_NAME: chip + TAG_NAME: latest jobs: build: @@ -55,7 +53,7 @@ jobs: uses: docker/build-push-action@v3 with: context: tools/docker - file: tools/docker/chip-builds + file: tools/docker/matter-builds push: true tags: ${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }} platforms: ${{ env.BUILD_PLATFORMS }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 4f87aac1c..0999967ab 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -18,8 +18,9 @@ name: Build and Deploy example bins to github pages on: - push: - branches: ["main"] + workflow_run: + workflows: ["Docker Image CI"] + types: [completed] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -36,46 +37,38 @@ concurrency: cancel-in-progress: true jobs: - Build: # Disable the job in forks if: ${{ github.repository_owner == 'espressif' }} runs-on: ubuntu-latest container: - image: espressif/esp-matter:chip + image: espressif/esp-matter:latest strategy: matrix: build-dir: ['examples/light', 'examples/light_switch'] targets: ['esp32', 'esp32c3'] + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: idf stuff - run: | - rm -rf connectedhomeip/connectedhomeip - ln -s $CHIP_PATH connectedhomeip - mkdir -p images - + - run: mkdir -p images - name: build application run: | - export ESP_MATTER_PATH=$PWD . $IDF_PATH/export.sh . $ESP_MATTER_PATH/export.sh - cd ${{matrix.build-dir}} + cd $ESP_MATTER_PATH/${{matrix.build-dir}} idf.py set-target ${{matrix.targets}} build cd build TARGET_CHIP=`cat project_description.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["target"])'` APP_BIN=`cat project_description.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["app_bin"])'` - esptool.py --chip $TARGET_CHIP merge_bin -o "$ESP_MATTER_PATH/images/$TARGET_CHIP"_"$APP_BIN" `cat flash_args | tr '\n' '\ '` + esptool.py --chip $TARGET_CHIP merge_bin -o "$GITHUB_WORKSPACE/images/$TARGET_CHIP"_"$APP_BIN" `cat flash_args | tr '\n' '\ '` - name: Upload artifact uses: actions/upload-artifact@v3 with: name: build-images - path: 'images/' + path: images/ deploy: # Disable the job in forks @@ -88,12 +81,9 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest container: - image: espressif/esp-matter:chip + image: espressif/esp-matter:latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Download builds uses: actions/download-artifact@v3 with: @@ -102,9 +92,9 @@ jobs: - name: generate launchpad config run: | - cd images + cd images/ ls - ../tools/launchpad/generate_launchpad_config.sh + $ESP_MATTER_PATH/tools/launchpad/generate_launchpad_config.sh - name: Setup Pages uses: actions/configure-pages@v2 @@ -112,7 +102,7 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: - path: 'images/' + path: images/ - name: Deploy to GitHub Pages id: deployment diff --git a/tools/docker/chip-builds b/tools/docker/chip-builds deleted file mode 100644 index 5effb0777..000000000 --- a/tools/docker/chip-builds +++ /dev/null @@ -1,20 +0,0 @@ -ARG VERSION=latest -FROM connectedhomeip/chip-build-esp32:${VERSION} as build - -WORKDIR /opt/espressif/connectedhomeip -ENV CHIP_PATH=/opt/espressif/connectedhomeip - -RUN set -x \ - && git init \ - && git remote add origin https://github.com/project-chip/connectedhomeip.git \ - && git fetch origin --depth 1 v1.0.0.2 \ - && git checkout FETCH_HEAD \ - && : # last line - -RUN set -x \ - && scripts/checkout_submodules.py --platform esp32 --shallow \ - && : # last line - -RUN set -x \ - && scripts/build/gn_bootstrap.sh \ - && : # last line diff --git a/tools/docker/matter-builds b/tools/docker/matter-builds new file mode 100644 index 000000000..96d29019e --- /dev/null +++ b/tools/docker/matter-builds @@ -0,0 +1,16 @@ +ARG VERSION=latest +FROM connectedhomeip/chip-build-esp32:${VERSION} as build + +WORKDIR /opt/espressif +ENV ESP_MATTER_PATH=/opt/espressif/esp-matter + +RUN set -x \ + && git clone --depth 1 https://github.com/espressif/esp-matter.git \ + && cd esp-matter \ + && git submodule update --init --depth 1 \ + && ./connectedhomeip/connectedhomeip/scripts/checkout_submodules.py --platform esp32 --shallow \ + && . $IDF_PATH/export.sh \ + && ./install.sh \ + && : # last line + +WORKDIR /opt/espressif/esp-matter