Skip to content

Commit ae0c478

Browse files
committed
Merge branch 'bugfix/docker'
2 parents 20af134 + fe7799d commit ae0c478

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

.github/workflows/docker.yml

+28-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
- 'release/*'
88
tags:
99
- 'v*.*'
10+
pull_request:
11+
paths:
12+
- ".github/workflows/docker.yml"
13+
- "tools/config_editor/**"
14+
- "tools/docker/**"
15+
- "!**.md"
1016

1117
env:
1218
# Build the image for amd64 and arm64
@@ -16,7 +22,7 @@ env:
1622
jobs:
1723
docker:
1824
# Disable the job in forks
19-
if: ${{ github.repository_owner == 'espressif' }}
25+
if: ${{ github.event_name == 'pull_request' || github.repository_owner == 'espressif' }}
2026

2127
runs-on: ubuntu-latest
2228
steps:
@@ -29,50 +35,66 @@ jobs:
2935
run: |
3036
echo "CLONE_BRANCH_OR_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
3137
echo "TAG_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
38+
echo "URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
39+
3240
- name: Set variables (release branches)
3341
if: ${{ github.ref_type == 'branch' && startsWith(github.ref_name, 'release/') }}
3442
run: |
3543
echo "CLONE_BRANCH_OR_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
3644
echo "TAG_NAME=release-${GITHUB_REF_NAME##release/}" >> $GITHUB_ENV
45+
echo "URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
46+
3747
- name: Set variables (main branch)
3848
if: ${{ github.ref_type == 'branch' && github.ref_name == 'master' }}
3949
run: |
4050
echo "CLONE_BRANCH_OR_TAG=master" >> $GITHUB_ENV
4151
echo "TAG_NAME=latest" >> $GITHUB_ENV
52+
echo "URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
53+
54+
- name: Set variables (pull requests)
55+
if: ${{ github.event_name == 'pull_request' }}
56+
run: |
57+
echo "CLONE_BRANCH_OR_TAG=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
58+
echo "TAG_NAME=PR_${{ github.event.number }}" >> $GITHUB_ENV
59+
echo "URL=${{ github.server_url }}/${{ github.event.pull_request.head.repo.full_name }}.git" >> $GITHUB_ENV
4260
4361
# Display the variables set above, just in case.
4462
- name: Check variables
4563
run: |
4664
echo "CLONE_BRANCH_OR_TAG: $CLONE_BRANCH_OR_TAG"
4765
echo "CHECKOUT_REF: $CHECKOUT_REF"
4866
echo "TAG_NAME: $TAG_NAME"
67+
echo "URL: $URL"
4968
50-
# The following steps are the standard boilerplate from
51-
# https://github.com/marketplace/actions/build-and-push-docker-images
5269
- name: Checkout
5370
uses: actions/checkout@v4
71+
5472
- name: Login to Docker Hub
73+
if: ${{ github.event_name == 'push' }}
5574
uses: docker/login-action@v3
5675
with:
5776
username: ${{ secrets.DOCKERHUB_USERNAME }}
5877
password: ${{ secrets.DOCKERHUB_TOKEN }}
78+
5979
- name: Set up QEMU for multiarch builds
6080
uses: docker/setup-qemu-action@v3
81+
6182
- name: Set up Docker Buildx
6283
uses: docker/setup-buildx-action@v3
84+
6385
- name: Build and push
6486
uses: docker/build-push-action@v5
6587
with:
6688
context: tools/docker
67-
push: true
89+
push: ${{ github.event_name == 'push' }}
6890
tags: ${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }}
6991
platforms: ${{ env.BUILD_PLATFORMS }}
7092
build-args: |
71-
LIBBUILDER_CLONE_URL=${{ github.server_url }}/${{ github.repository }}.git
93+
LIBBUILDER_CLONE_URL=${{ env.URL }}
7294
LIBBUILDER_CLONE_BRANCH_OR_TAG=${{ env.CLONE_BRANCH_OR_TAG }}
7395
7496
- name: Update Docker Hub repository description (master branch)
75-
if: ${{ github.ref_type == 'branch' && github.ref_name == 'master' }}
97+
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref_name == 'master' }}
7698
uses: peter-evans/dockerhub-description@v4
7799
with:
78100
username: ${{ secrets.DOCKERHUB_USERNAME }}

.github/workflows/push.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ on:
55
branches:
66
- master
77
pull_request:
8+
paths:
9+
- "**"
10+
- "!**.md"
11+
- "!.github/workflows/cron_build.yml"
12+
- "!.github/workflows/cron.yml"
13+
- "!.github/workflows/docker.yml"
14+
- "!.github/workflows/repository_dispatch.yml"
15+
- "!tools/config_editor/**"
16+
- "!tools/docker/**"
817

918
concurrency:
1019
group: esp-idf-libs-${{github.event.pull_request.number || github.ref}}
1120
cancel-in-progress: true
1221

1322
jobs:
14-
1523
build-libs:
1624
name: Build Libs for ${{ matrix.target }}
1725
runs-on: ubuntu-latest
@@ -21,16 +29,20 @@ jobs:
2129
fail-fast: false
2230
steps:
2331
- uses: actions/checkout@v4
32+
2433
- name: Install dependencies
2534
run: bash ./tools/prepare-ci.sh
35+
2636
- name: Build Libs for ${{ matrix.target }}
2737
run: bash ./build.sh -e -t ${{ matrix.target }}
38+
2839
- name: Upload build
2940
if: failure()
3041
uses: actions/upload-artifact@v4
3142
with:
3243
name: build-${{ matrix.target }}
3344
path: build
45+
3446
- name: Upload archive
3547
uses: actions/upload-artifact@v4
3648
with:
@@ -48,17 +60,20 @@ jobs:
4860
path: dist
4961
pattern: artifacts-*
5062
merge-multiple: true
63+
5164
- shell: bash
5265
run: |
5366
mkdir -p out
5467
find dist -name 'arduino-esp32-libs-esp*.tar.gz' -exec tar zxvf {} -C out \;
5568
cd out/tools/esp32-arduino-libs && tar zcf ../../../dist/esp32-arduino-libs.tar.gz * && cd ../../..
5669
cp out/package_esp32_index.template.json dist/package_esp32_index.template.json
70+
5771
- name: Upload full esp32-arduino-libs archive
5872
uses: actions/upload-artifact@v4
5973
with:
6074
name: esp32-arduino-libs
6175
path: dist/esp32-arduino-libs.tar.gz
76+
6277
- name: Upload package_esp32_index.template.json
6378
uses: actions/upload-artifact@v4
6479
with:

tools/docker/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ RUN : \
3434
python3-setuptools \
3535
python3-venv \
3636
wget \
37-
&& pip3 install --upgrade pip textual-dev \
3837
&& apt-get autoremove -y \
3938
&& rm -rf /var/lib/apt/lists/* \
4039
&& :
@@ -70,7 +69,8 @@ RUN echo LIBBUILDER_CHECKOUT_REF=$LIBBUILDER_CHECKOUT_REF LIBBUILDER_CLONE_BRANC
7069
fi && \
7170
git checkout $LIBBUILDER_CHECKOUT_REF && \
7271
git submodule update --init --recursive; \
73-
fi
72+
fi && \
73+
pip3 install --upgrade -r $LIBBUILDER_PATH/tools/config_editor/requirements.txt
7474

7575
COPY entrypoint.sh $LIBBUILDER_PATH/entrypoint.sh
7676

0 commit comments

Comments
 (0)