Reduce the number of redundant test runs. Disable SNTP test on macos - it is flaky

This commit is contained in:
cpq 2023-02-04 18:45:05 +00:00
parent 4ae4ff72e3
commit 8d824799a0
4 changed files with 90 additions and 21 deletions

View File

@ -4,14 +4,20 @@ jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 2 }
- id: check
run: /bin/bash test/check.sh '^src/'
- name: Build Fuzzers
id: build
if: steps.check.outputs.MATCH == 1
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'mongoose'
dry-run: false
language: c++
- name: Run Fuzzers
if: steps.check.outputs.MATCH == 1
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'mongoose'
@ -20,7 +26,7 @@ jobs:
language: c++
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
if: steps.check.outputs.MATCH == 1 && failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts

View File

@ -1,5 +1,10 @@
name: build
on: [push, pull_request]
on:
push:
paths:
- "**Makefile"
- "**.c"
- "**.h"
env:
IPV6: 0
jobs:
@ -18,9 +23,15 @@ jobs:
SSL: ${{ matrix.ssl }}
steps:
- uses: actions/checkout@v3
- run: ./test/setup_ga_network.sh
- run: sudo apt-get update ; sudo apt-get install libmbedtls-dev
- run: make ${{ matrix.target }}
with: { fetch-depth: 2 }
- id: check
run: /bin/bash test/check.sh '^test|^src'
- if: steps.check.outputs.MATCH == 1
run: ./test/setup_ga_network.sh
- if: steps.check.outputs.MATCH == 1
run: sudo apt-get update ; sudo apt-get install libmbedtls-dev
- if: steps.check.outputs.MATCH == 1
run: make ${{ matrix.target }}
s390:
runs-on: ubuntu-latest
steps:
@ -55,24 +66,28 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls openssl
- run: make test upload-coverage SSL=OPENSSL ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
- run: make test SSL=MBEDTLS ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
- run: make test upload-coverage TFLAGS=-DNO_SNTP_CHECK SSL=OPENSSL ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
- run: make test SSL=MBEDTLS TFLAGS=-DNO_SNTP_CHECK ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
#- run: make mip_test ASAN_OPTIONS=
- run: make mg_prefix
windows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make vc98
- run: make vc17
- run: make vc22
- run: make mingw
- run: make mingw++
with: { fetch-depth: 2 }
- id: check
run: /bin/bash test/check.sh '^test|^src'
- if: steps.check.outputs.MATCH == 1
run: make vc98 vc17 vc22 mingw mingw++
arduino-xiao:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make arduino-xiao
with: { fetch-depth: 2 }
- id: check
run: /bin/bash test/check.sh '^examples/arduino|^src'
- if: steps.check.outputs.MATCH == 1
run: make arduino-xiao
arm:
runs-on: ubuntu-latest
steps:
@ -138,21 +153,37 @@ jobs:
name: ${{ matrix.example.path }}
steps:
- uses: actions/checkout@v3
- run: sudo apt -y install gcc-arm-none-eabi
with: { fetch-depth: 2 }
- id: check
run: /bin/bash test/check.sh '^src|^examples/${{ matrix.example.path }}'
- if: steps.check.outputs.MATCH == 1
run: sudo apt -y install gcc-arm-none-eabi
- name: ${{ matrix.example.path }}
if: steps.check.outputs.MATCH == 1
run: make -C examples/${{ matrix.example.path }} ${{ matrix.example.target || 'build' }} VCON_API_KEY=${{secrets.VCON_API_KEY}}
zephyr_examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make -C examples/zephyr init
with: { fetch-depth: 2 }
- id: check
run: /bin/bash test/check.sh '^examples/zephyr|^src'
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr init
- name: minify manifest
if: steps.check.outputs.MATCH == 1
uses: mikefarah/yq@master
with:
cmd: yq -i eval '(.manifest.defaults, .manifest.remotes, .manifest.projects[] | select(.name == "cmsis" or .name == "hal_stm32" or .name == "mbedtls" or .name == "mcuboot" or .name == "picolibc" | del(.null) ), .manifest.self) as $i ireduce({};setpath($i | path; $i)) | del(.manifest.projects.[].null) | del(..|select(length==0))' examples/zephyr/zephyrproject/zephyr/west.yml
- run: make -C examples/zephyr update
- run: make -C examples/zephyr/device-dashboard build
- run: make -C examples/zephyr/http-client build
- run: make -C examples/zephyr/http-server build
- run: make -C examples/zephyr/mqtt-aws-client build
- run: make -C examples/zephyr/websocket-server build
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr update
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr/device-dashboard build
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr/http-client build
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr/http-server build
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr/mqtt-aws-client build
- if: steps.check.outputs.MATCH == 1
run: make -C examples/zephyr/websocket-server build

30
test/check.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
#
# This script is used by the Github Actions
# o must be run with one parameter: a glob pattern
# o write "MATCH=1" (changed files match a pattern) or "MATCH=0" to $GITHUB_OUTPUT
#
# Usage in github actions:
# <job_name>:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with: { fetch-depth: 2 } # Important for git diff to work
# - id: check
# run: /bin/bash check.sh '.*'
# - if: steps.check.outputs.MATCH == 1
# run: .....
# List all files changed by the last commit, and compare with the passed
# pattern argument. If at least one file matches the pattern, write
# MATCH=1. If no files match, write MATCH=0.
for FILE in $(git --no-pager diff --name-only HEAD~1 HEAD) ; do
if [[ "$FILE" =~ $1 ]] ; then
echo FILE "$FILE" matches $1 # Log for debugging
echo MATCH=1 >> $GITHUB_OUTPUT
exit 0 # And exit early
else
echo FILE "$FILE" DOES NOT match $1 # Log for debugging
fi
done
echo MATCH=0 >> $GITHUB_OUTPUT

View File

@ -319,7 +319,9 @@ static void test_sntp_server(const char *url) {
ASSERT(c->is_udp == 1);
for (i = 0; i < 60 && ms == 0; i++) mg_mgr_poll(&mgr, 50);
MG_DEBUG(("server: %s, ms: %lld", url ? url : "(default)", ms));
#if !defined(NO_SNTP_CHECK)
ASSERT(ms > 0);
#endif
mg_mgr_free(&mgr);
}