mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-26 22:41:03 +08:00
Serialize HW tests
This commit is contained in:
parent
5aebed95a4
commit
6f011fce3b
157
.github/workflows/test.yml
vendored
157
.github/workflows/test.yml
vendored
@ -15,7 +15,6 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
cc: [gcc, clang, g++, clang++]
|
cc: [gcc, clang, g++, clang++]
|
||||||
target: [test, mip_test]
|
target: [test, mip_test]
|
||||||
# target: [test]
|
|
||||||
ssl: [MBEDTLS, OPENSSL]
|
ssl: [MBEDTLS, OPENSSL]
|
||||||
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
||||||
env:
|
env:
|
||||||
@ -24,55 +23,35 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^test|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: ./test/setup_ga_network.sh && sudo apt -y update ; sudo apt -y install libmbedtls-dev && make ${{ matrix.target }}
|
||||||
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:
|
s390:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^test|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make s390
|
||||||
run: sudo apt-get update && sudo apt-get install qemu binfmt-support qemu-user-static
|
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make s390
|
|
||||||
armhf:
|
armhf:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^test|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make armhf
|
||||||
run: sudo apt-get update && sudo apt-get install qemu binfmt-support qemu-user-static
|
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make armhf
|
|
||||||
linux2:
|
linux2:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^test|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: sudo apt -y update ; sudo apt -y install libmbedtls-dev valgrind
|
||||||
run: sudo apt-get update ; sudo apt-get install libmbedtls-dev valgrind
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: make unamalgamated && make valgrind && make mg_prefix
|
||||||
run: make unamalgamated
|
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make valgrind
|
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make mg_prefix
|
|
||||||
examples:
|
examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -82,37 +61,34 @@ jobs:
|
|||||||
- run: make clean test MG_ENABLE_POLL=1
|
- run: make clean test MG_ENABLE_POLL=1
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^test|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: brew install jq mbedtls openssl
|
||||||
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls openssl
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make test upload-coverage TFLAGS=-DNO_SNTP_CHECK SSL=OPENSSL ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
run: make test upload-coverage TFLAGS=-DNO_SNTP_CHECK SSL=OPENSSL ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make test SSL=MBEDTLS TFLAGS="-DNO_SNTP_CHECK -DMG_ENABLE_ATOMIC=1" ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
|
run: make test SSL=MBEDTLS TFLAGS="-DNO_SNTP_CHECK -DMG_ENABLE_ATOMIC=1" ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
|
||||||
#- run: make mip_test ASAN_OPTIONS=
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make mg_prefix
|
run: make mg_prefix
|
||||||
windows:
|
windows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^test|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make vc98 vc17 vc22 mingw mingw++
|
run: make vc98 vc17 vc22 mingw mingw++
|
||||||
arduino-xiao:
|
arduino-xiao:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^examples/arduino|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
run: /bin/bash test/check.sh '^examples/arduino|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make arduino-xiao
|
run: make arduino-xiao
|
||||||
arm:
|
arm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -124,6 +100,53 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: make riscv
|
- run: make riscv
|
||||||
|
|
||||||
|
test_f7:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-f7" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/stm32/nucleo-f746zg-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/stm32/nucleo-f746zg-freertos-mip test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_f4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-f4" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/stm32/nucleo-f429zi-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_h7:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-h7" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/stm32/nucleo-h743zi-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_pico_w5500:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh "^src|examples/rp2040/pico-w5500" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/rp2040/pico-w5500 test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
matrix_examples:
|
matrix_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@ -134,20 +157,16 @@ jobs:
|
|||||||
- path: esp32/uart-bridge
|
- path: esp32/uart-bridge
|
||||||
- path: esp8266/http-client-server
|
- path: esp8266/http-client-server
|
||||||
- path: stm32/nucleo-h743zi-baremetal
|
- path: stm32/nucleo-h743zi-baremetal
|
||||||
target: test
|
|
||||||
- path: stm32/stm32-freertos-tcp
|
- path: stm32/stm32-freertos-tcp
|
||||||
- path: stm32/stm32-nucleo-f746z
|
- path: stm32/stm32-nucleo-f746z
|
||||||
- path: stm32/stm32-nucleo-f746zg
|
- path: stm32/stm32-nucleo-f746zg
|
||||||
- path: stm32/stm32-nucleo-f429z
|
- path: stm32/stm32-nucleo-f429z
|
||||||
- path: stm32/stm32-nucleo-h743z
|
- path: stm32/stm32-nucleo-h743z
|
||||||
- path: stm32/nucleo-f429zi-baremetal
|
- path: stm32/nucleo-f429zi-baremetal
|
||||||
target: test
|
|
||||||
- path: stm32/nucleo-f429zi-freertos-mip
|
- path: stm32/nucleo-f429zi-freertos-mip
|
||||||
- path: stm32/nucleo-f429zi-usb-rndis
|
- path: stm32/nucleo-f429zi-usb-rndis
|
||||||
- path: stm32/nucleo-f746zg-baremetal
|
- path: stm32/nucleo-f746zg-baremetal
|
||||||
target: test
|
|
||||||
- path: stm32/nucleo-f746zg-freertos-mip
|
- path: stm32/nucleo-f746zg-freertos-mip
|
||||||
target: test
|
|
||||||
- path: stm32/nucleo-f746zg-usb-rndis
|
- path: stm32/nucleo-f746zg-usb-rndis
|
||||||
- path: nxp/nxp-mimxrt1020-azurertos
|
- path: nxp/nxp-mimxrt1020-azurertos
|
||||||
- path: nxp/nxp-frdmk66f-freertos
|
- path: nxp/nxp-frdmk66f-freertos
|
||||||
@ -176,41 +195,37 @@ jobs:
|
|||||||
- path: rp2040/pico-rndis-dashboard
|
- path: rp2040/pico-rndis-dashboard
|
||||||
- path: rp2040/pico-w
|
- path: rp2040/pico-w
|
||||||
- path: rp2040/pico-w5500
|
- path: rp2040/pico-w5500
|
||||||
target: test
|
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then sudo apt -y update ; sudo apt -y install gcc-arm-none-eabi ; fi
|
||||||
run: /bin/bash test/check.sh '^src|^examples/${{ matrix.example.path }}'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
run: sudo apt -y update ; sudo apt -y install gcc-arm-none-eabi
|
||||||
run: sudo apt -y install gcc-arm-none-eabi
|
- if: ${{ env.GO == 1 }}
|
||||||
- name: ${{ matrix.example.path }}
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
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:
|
zephyr_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- id: check
|
- run: if ./test/match_changed_files.sh '^src/.*.[ch]|^examples/zephyr'; then sudo apt -y update ; sudo apt -y install gcc-arm-none-eabi ; fi
|
||||||
run: /bin/bash test/check.sh '^examples/zephyr|^src/.*.[ch]'
|
- if: ${{ env.GO == 1 }}
|
||||||
- if: steps.check.outputs.MATCH == 1
|
|
||||||
run: make -C examples/zephyr init
|
run: make -C examples/zephyr init
|
||||||
- name: minify manifest
|
- name: minify manifest
|
||||||
if: steps.check.outputs.MATCH == 1
|
if: ${{ env.GO == 1 }}
|
||||||
uses: mikefarah/yq@master
|
uses: mikefarah/yq@master
|
||||||
with:
|
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
|
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
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr update
|
run: make -C examples/zephyr update
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr/device-dashboard build
|
run: make -C examples/zephyr/device-dashboard build
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr/http-client build
|
run: make -C examples/zephyr/http-client build
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr/http-server build
|
run: make -C examples/zephyr/http-server build
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr/mqtt-aws-client build
|
run: make -C examples/zephyr/mqtt-aws-client build
|
||||||
- if: steps.check.outputs.MATCH == 1
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr/websocket-server build
|
run: make -C examples/zephyr/websocket-server build
|
||||||
|
@ -8,7 +8,7 @@ LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--
|
|||||||
SOURCES = main.c syscalls.c sysinit.c
|
SOURCES = main.c syscalls.c sysinit.c
|
||||||
SOURCES += cmsis_f7/Source/Templates/gcc/startup_stm32f746xx.s # ST startup file. Compiler-dependent!
|
SOURCES += cmsis_f7/Source/Templates/gcc/startup_stm32f746xx.s # ST startup file. Compiler-dependent!
|
||||||
|
|
||||||
# Mongoose-specific source code files and build options. See https://mongoose.ws/documentation/#build-options
|
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
|
||||||
SOURCES += mongoose.c net.c packed_fs.c
|
SOURCES += mongoose.c net.c packed_fs.c
|
||||||
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
|
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
|
||||||
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 $(CFLAGS_EXTRA)
|
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 $(CFLAGS_EXTRA)
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
#!/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 # Set output
|
|
||||||
exit 0 # And exit early
|
|
||||||
else
|
|
||||||
echo FILE "$FILE" DOES NOT match "$1" # Log for debugging
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo MATCH=0 >> $GITHUB_OUTPUT
|
|
19
test/match_changed_files.sh
Executable file
19
test/match_changed_files.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Usage: $0 PATTERN
|
||||||
|
# If files in the last commit match PATTERN, exit 0. Else, exit 1
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# - run: if ./match_changed_files.sh '.*' ; then echo RUN=1 >> $GITHUB_ENV ; fi
|
||||||
|
# - if: ${{ env.RUN == 1 }}
|
||||||
|
# run: echo yohoo!
|
||||||
|
|
||||||
|
CHANGED_FILES=`git --no-pager diff --name-only HEAD~1 HEAD | xargs`
|
||||||
|
echo "Pattern: [$1], files: $CHANGED_FILES"
|
||||||
|
for FILE in $CHANGED_FILES; do [[ "$FILE" =~ $1 ]] && exit 0; done
|
||||||
|
exit 1
|
Loading…
x
Reference in New Issue
Block a user