Merge pull request #274 from david-cermak/bugfix/ci_mdns_all_targets

mdns: Build all targets and releases
This commit is contained in:
david-cermak
2023-04-18 10:38:46 +02:00
committed by GitHub
7 changed files with 48 additions and 123 deletions

View File

@ -13,122 +13,33 @@ jobs:
name: Build name: Build
strategy: strategy:
matrix: matrix:
idf_ver: ["latest"] idf_ver: ["latest", "release-v5.0"]
idf_target: ["esp32", "esp32s2", "esp32c3"] test: [ { app: example, path: "examples" }, { app: unit_test, path: "tests/unit_test" }, { app: test_app, path: "tests/test_apps" } ]
test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: espressif/idf:${{ matrix.idf_ver }} container: espressif/idf:${{ matrix.idf_ver }}
steps: steps:
- name: Checkout esp-protocols - name: Checkout esp-protocols
uses: actions/checkout@v3 uses: actions/checkout@v3
with: - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }}
submodules: recursive
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
shell: bash shell: bash
working-directory: ${{ matrix.test.path }}
run: | run: |
${IDF_PATH}/install.sh --enable-pytest
. ${IDF_PATH}/export.sh . ${IDF_PATH}/export.sh
python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --preserve-all --pytest-app python -m pip install idf-build-apps
for dir in `ls -d build_*`; do # Build default configs for all targets
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }} -r default -m components/mdns/.build-test-rules.yml -d
# Build specific configs for test targets
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }}
cd components/mdns/${{ matrix.test.path }}
for dir in `ls -d build_esp32_*`; do
$GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/$dir $GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/$dir
zip -qur artifacts.zip $dir zip -qur artifacts.zip $dir
done done
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: ${{ matrix.idf_target }} == "esp32"
with: with:
name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} name: mdns_bin_esp32_${{ matrix.idf_ver }}_${{ matrix.test.app }}
path: ${{ matrix.test.path }}/artifacts.zip path: components/mdns/${{ matrix.test.path }}/artifacts.zip
if-no-files-found: error if-no-files-found: error
build_mdns_app:
if: contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push'
name: Build Test Apps
strategy:
matrix:
idf_ver: ["latest"]
idf_target: ["esp32", "esp32s2", "esp32c3"]
runs-on: ubuntu-20.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- name: Checkout esp-protocols
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Build Environment
working-directory: components/mdns/tests/test_apps
run: |
. ${IDF_PATH}/export.sh
pip install -r $GITHUB_WORKSPACE/ci/requirements.txt
- name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
env:
IDF_TARGET: ${{ matrix.idf_target }}
shell: bash
working-directory: components/mdns/tests/test_apps
run: |
. ${IDF_PATH}/export.sh
python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --pytest-apps
- name: Merge binaries with IDF-${{ matrix.idf_ver }}
working-directory: components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default
env:
IDF_TARGET: ${{ matrix.idf_target }}
shell: bash
run: |
. ${IDF_PATH}/export.sh
esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args
- uses: actions/upload-artifact@v2
with:
name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}
path: |
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/bootloader/bootloader.bin
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/partition_table/partition-table.bin
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/*.bin
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/*.elf
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/flasher_args.json
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/config/sdkconfig.h
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/config/sdkconfig.json
if-no-files-found: error
target_test_apps_mdns:
# Skip running on forks since it won't have access to secrets
if: |
github.repository == 'espressif/esp-protocols' &&
( contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push' )
name: Target Test Apps
strategy:
matrix:
idf_ver: ["latest"]
idf_target: ["esp32"]
needs: build_mdns_app
runs-on:
- self-hosted
- ESP32-ETHERNET-KIT
steps:
- name: Clear repository
run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
with:
name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}
path: components/mdns/tests/test_apps/build
- name: Install Python packages
env:
PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple"
run: |
sudo apt-get install -y dnsutils
- name: Download Test apps to target
run: |
python -m esptool --chip ${{ matrix.idf_target }} write_flash 0x0 components/mdns/tests/test_apps/build/flash_image.bin
- name: Run Example Test on target
working-directory: components/mdns/tests/test_apps
run: |
python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml --target=${{matrix.idf_target}}
- uses: actions/upload-artifact@v2
if: always()
with:
name: test_apps_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}
path: components/mdns/tests/test_apps/*.xml
target_tests_mdns: target_tests_mdns:
# Skip running on forks since it won't have access to secrets # Skip running on forks since it won't have access to secrets
if: | if: |
@ -139,7 +50,7 @@ jobs:
matrix: matrix:
idf_ver: ["latest"] idf_ver: ["latest"]
idf_target: ["esp32"] idf_target: ["esp32"]
test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ] test: [ { app: example, path: "examples" }, { app: unit_test, path: "tests/unit_test" }, { app: test_app, path: "tests/test_apps" } ]
needs: build_mdns needs: build_mdns
runs-on: runs-on:
- self-hosted - self-hosted
@ -151,14 +62,14 @@ jobs:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }}
path: ${{ matrix.test.path }}/ci/ path: components/mdns/${{ matrix.test.path }}/ci/
- name: Install Python packages - name: Install Python packages
env: env:
PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple"
run: | run: |
sudo apt-get install -y dnsutils sudo apt-get install -y dnsutils
- name: Run ${{ matrix.test.app }} application on ${{ matrix.idf_target }} - name: Run ${{ matrix.test.app }} application on ${{ matrix.idf_target }}
working-directory: ${{ matrix.test.path }} working-directory: components/mdns/${{ matrix.test.path }}
run: | run: |
unzip ci/artifacts.zip -d ci unzip ci/artifacts.zip -d ci
for dir in `ls -d ci/build_*`; do for dir in `ls -d ci/build_*`; do
@ -170,4 +81,4 @@ jobs:
if: always() if: always()
with: with:
name: results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml name: results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml
path: ${{ matrix.test.path }}/*.xml path: components/mdns/${{ matrix.test.path }}/*.xml

View File

@ -48,7 +48,7 @@ jobs:
. ${IDF_PATH}/export.sh . ${IDF_PATH}/export.sh
python -m pip install idf-build-apps python -m pip install idf-build-apps
cd $GITHUB_WORKSPACE/protocols cd $GITHUB_WORKSPACE/protocols
python ./ci/build_apps.py components/esp_modem/examples/${{ matrix.example }} python ./ci/build_apps.py components/esp_modem/examples/${{ matrix.example }} -m components/esp_modem/examples/.build-test-rules.yml
host_test_esp_modem: host_test_esp_modem:
if: contains(github.event.pull_request.labels.*.name, 'modem') || github.event_name == 'push' if: contains(github.event.pull_request.labels.*.name, 'modem') || github.event_name == 'push'

View File

@ -12,12 +12,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Fetch head and base refs - name: Fetch head and base refs
# This is necessary for pre-commit to check the changes in the PR branch # This is necessary for pre-commit to check the changes in the PR branch (and to set origin/HEAD and HEAD refs)
run: | run: |
git fetch origin ${{ github.base_ref }}:base_ref git fetch origin ${{ github.event.pull_request.head.sha }}:pr_ref
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref git checkout pr_ref
git remote set-head origin --auto
- name: Set up Python environment - name: Set up Python environment
uses: actions/setup-python@master uses: actions/setup-python@master
with: with:
@ -26,13 +29,12 @@ jobs:
run: | run: |
pip install pre-commit pip install pre-commit
pre-commit install-hooks pre-commit install-hooks
pre-commit install --hook-type commit-msg --hook-type pre-push
- name: Run pre-commit and check for any changes - name: Run pre-commit and check for any changes
run: | run: |
echo "Commits being checked:" echo "Commits being checked:"
git log --oneline --no-decorate base_ref..pr_ref git log --oneline --no-decorate origin/HEAD..HEAD
echo "" echo ""
if ! pre-commit run --from-ref base_ref --to-ref pr_ref --show-diff-on-failure ; then if ! pre-commit run --from-ref origin/HEAD --to-ref HEAD --hook-stage manual --show-diff-on-failure ; then
echo "" echo ""
echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed." echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
echo "::notice::Please see https://github.com/espressif/esp-protocols/CONTRIBUTING.md for instructions." echo "::notice::Please see https://github.com/espressif/esp-protocols/CONTRIBUTING.md for instructions."

View File

@ -57,7 +57,7 @@ repos:
hooks: hooks:
- id: commitizen - id: commitizen
- id: commitizen-branch - id: commitizen-branch
stages: [push] stages: [push, manual]
- repo: local - repo: local
hooks: hooks:
- id: commit message scopes - id: commit message scopes

View File

@ -7,7 +7,6 @@ This file is used in CI for esp-protocols build tests
import argparse import argparse
import os import os
import sys import sys
from pathlib import Path
from idf_build_apps import build_apps, find_apps, setup_logging from idf_build_apps import build_apps, find_apps, setup_logging
from idf_build_apps.constants import SUPPORTED_TARGETS from idf_build_apps.constants import SUPPORTED_TARGETS
@ -24,6 +23,9 @@ if __name__ == '__main__':
default='all', default='all',
help='Build apps for given target', help='Build apps for given target',
) )
parser.add_argument('-r', '--rules', nargs='*', default=['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'], help='Rules how to treat configs')
parser.add_argument('-m', '--manifests', nargs='*', default=[], help='list of manifest files')
parser.add_argument('-d', '--delete', action='store_true', help='Delete build artifacts')
args = parser.parse_args() args = parser.parse_args()
IDF_PATH = os.environ['IDF_PATH'] IDF_PATH = os.environ['IDF_PATH']
@ -32,19 +34,15 @@ if __name__ == '__main__':
setup_logging(2) setup_logging(2)
apps = find_apps( apps = find_apps(
args.paths, args.paths,
recursive=True, recursive=False,
target=args.target, target=args.target,
build_dir='build_@t_@w', build_dir='build_@t_@w',
config_rules_str=[ config_rules_str=args.rules,
'sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'
],
build_log_path='build_log.txt', build_log_path='build_log.txt',
size_json_path='size.json', size_json_path='size.json',
check_warnings=True, check_warnings=True,
preserve=True, preserve=not args.delete,
manifest_files=[ manifest_files=args.manifests,
str(p) for p in Path('.').glob('**/.build-test-rules.yml')
],
default_build_targets=SUPPORTED_TARGETS, default_build_targets=SUPPORTED_TARGETS,
manifest_rootpath='.', manifest_rootpath='.',
) )

View File

@ -0,0 +1,11 @@
components/mdns/examples:
disable:
- if: IDF_TARGET in ["esp32h2"]
components/mdns/tests/unit_test:
disable:
- if: IDF_TARGET in ["esp32h2"]
components/mdns/tests/test_apps:
disable:
- if: IDF_TARGET in ["esp32h2"]

View File

@ -0,0 +1,3 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_UNITY_ENABLE_FIXTURE=y
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n