|
| 1 | +name: "lws: build-tests-server" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize, reopened, labeled] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build_lws_server: |
| 12 | + if: contains(github.event.pull_request.labels.*.name, 'lws') || github.event_name == 'push' |
| 13 | + name: Libwebsockets server build |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + idf_ver: ["latest", "release-v5.3", "release-v5.4"] |
| 17 | + test: [ { app: example, path: "examples/server-echo" }] |
| 18 | + runs-on: ubuntu-22.04 |
| 19 | + container: espressif/idf:${{ matrix.idf_ver }} |
| 20 | + env: |
| 21 | + TEST_DIR: components/libwebsockets/${{ matrix.test.path }} |
| 22 | + steps: |
| 23 | + - name: Checkout esp-protocols |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + submodules: recursive |
| 27 | + - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + . ${IDF_PATH}/export.sh |
| 31 | + python -m pip install idf-build-apps |
| 32 | + python ./ci/build_apps.py ${TEST_DIR} |
| 33 | + cd ${TEST_DIR} |
| 34 | + for dir in `ls -d build_esp32_*`; do |
| 35 | + $GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/$dir |
| 36 | + zip -qur artifacts.zip $dir |
| 37 | + done |
| 38 | + - uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: lws_target_esp32_${{ matrix.idf_ver }}_${{ matrix.test.app }} |
| 41 | + path: ${{ env.TEST_DIR }}/artifacts.zip |
| 42 | + if-no-files-found: error |
| 43 | + |
| 44 | + run-target-lws-server: |
| 45 | + if: | |
| 46 | + github.repository == 'espressif/esp-protocols' && |
| 47 | + ( contains(github.event.pull_request.labels.*.name, 'lws') || github.event_name == 'push' ) |
| 48 | + name: Target server test |
| 49 | + needs: build_lws_server |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + idf_ver: ["latest", "release-v5.3", "release-v5.4"] |
| 54 | + idf_target: ["esp32"] |
| 55 | + test: [ { app: example, path: "examples/server-echo" }] |
| 56 | + runs-on: |
| 57 | + - self-hosted |
| 58 | + - ESP32-ETHERNET-KIT |
| 59 | + env: |
| 60 | + TEST_DIR: components/libwebsockets/${{ matrix.test.path }} |
| 61 | + |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + - uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + name: lws_target_esp32_${{ matrix.idf_ver }}_${{ matrix.test.app }} |
| 67 | + path: ${{ env.TEST_DIR }}/ci/ |
| 68 | + - name: Install Python packages |
| 69 | + env: |
| 70 | + PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" |
| 71 | + run: | |
| 72 | + pip install --only-binary cryptography --extra-index-url https://dl.espressif.com/pypi/ -r $GITHUB_WORKSPACE/ci/requirements.txt websocket-client |
| 73 | + - name: Run Example Test on target |
| 74 | + working-directory: ${{ env.TEST_DIR }} |
| 75 | + run: | |
| 76 | + unzip ci/artifacts.zip -d ci |
| 77 | + for dir in `ls -d ci/build_*`; do |
| 78 | + rm -rf build sdkconfig.defaults |
| 79 | + mv $dir build |
| 80 | + python -m pytest --log-cli-level DEBUG --junit-xml=./results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${dir#"ci/build_"}.xml --target=${{ matrix.idf_target }} |
| 81 | + done |
| 82 | + - uses: actions/upload-artifact@v4 |
| 83 | + if: always() |
| 84 | + with: |
| 85 | + name: results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml |
| 86 | + path: components/libwebsockets/${{ matrix.test.path }}/*.xml |
0 commit comments