diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 00000000..9e4d3ef1 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,47 @@ +# Normal push, check the build status for the nighly builder or the release + +name: ESPurna build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + architecture: x64 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Cache Node + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-${{ hashFiles('code/package-lock.json', 'code/package.json') }} + - name: Cache PlatformIO + uses: actions/cache@v2 + with: + path: ~/.platformio + key: ${{ runner.os }}-${{ hashFiles('code/platformio.ini') }} + - name: Host tests + run: | + ./ci_install.sh host + ./ci_script.sh host + - name: WebUI tests + run: | + ./ci_install.sh webui + ./ci_script.sh webui + - name: PlatformIO build + env: + BUILDER_TOTAL_THREADS: 4 + ESPURNA_PIO_PATCH_ISSUE_1610: "y" + ESPURNA_PIO_SHARED_LIBRARIES: "y" + TEST_ENV: "esp8266-4m-latest-base" + TEST_EXTRA_ARGS: "-a test/build/extra/secure_client.h" + run: | + git config --global advice.detachedHead false + ./ci_install.sh build + ./ci_script.sh build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 96398b3c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -os: linux -language: python -python: - - '3.8' -cache: - directories: - - ~/.npm - - ~/.platformio -env: - global: - - BUILDER_TOTAL_THREADS=4 - - ESPURNA_PIO_PATCH_ISSUE_1610=y - - ESPURNA_PIO_SHARED_LIBRARIES=y -install: - - ./travis_install.sh -script: - - ./travis_script.sh -stages: - - name: Test Host - if: tag IS NOT present - - name: Test WebUI - if: tag IS NOT present - - name: Test PlatformIO Build - if: tag IS NOT present - - name: Release - if: tag IS present AND tag =~ ^\d+\.\d+\.\d+$ -jobs: - include: - - stage: Test Host - - stage: Test WebUI - - stage: Test PlatformIO Build - env: >- - TEST_ENV=esp8266-4m-latest-base TEST_EXTRA_ARGS="-a - test/build/extra/secure_client.h" - - stage: Release - env: BUILDER_THREAD=0 - - env: BUILDER_THREAD=1 - - env: BUILDER_THREAD=2 - - env: BUILDER_THREAD=3 -before_deploy: - - mkdir -p firmware/ - - mv firmware/*/espurna-*.bin firmware/ -deploy: - provider: releases - api_key: - secure: >- - LMCdaQnCxSQ5EuKhqcFR6VTfDCWc06jwD4fdHfkmBaeWBMMzdoZEqN26AwdTnoLLlQJTR9l21NypgGybssBr69Md/ZinMahWCJJ4gVzPe9Adr9ijRbzj/wckirLBVZjRWn8fxTjJgjpu1ten2CgBfNcc/roN3fI6DV/1Fvv1REfihND4EeIermsxIVRXOyluu1vnPV9ZM28XBNch9XfkKwIpLEaHNNtkzlSEua39U34WpZShrxxEVoZhiF/R1ZF+NiAnursPcPsn5hdrXyHFLFT2dVDnlpdIp79c6SGkCZ636//5erB6hgBHshbwuT9TYXxtwLyL7AeN/MfCg0gtZSsDII8mLKzytW1tl7r1W9l7s21z/55tljSz2Z6dcbJC3bxucgcLxM9R6PrsPdDrPQTd0QwYqYalMNlfuA8KGcesZueqI9Q4uw7uHFUwIp7FIaoKhwhjTKe/ZHZ75zU4wdBTXof4dnSQOudoGGjRyyj7V0eR/Mhuni45N2Bldy9hDaldgtWMuEdx3ABW1IrPXtPDVTXM6QjUHm0nj5zzCgoCvQEw3jycA7Wlgbzo8MQkKH3u4MtupJcEGHJAqMbk+JlRpIfdWTiqtI697CReRGYSWT6YxF68TeJo77JPPph724BIBMtKtIk2+4RkHxz5RqM8O2vt+AFNjnWNIvVQtY8= - file_glob: true - file: firmware/espurna-*.bin - on: - tags: true - repo: xoseperez/espurna - condition: $TRAVIS_BUILD_STAGE_NAME = Release -notifications: - pushover: - api_key: - secure: >- - wtAleSibUqDOH7KskYMIFXwNqqZMA/2flCJzu835hSFWDFTjdXGeYLmQxCI7FGTWHcvWgf5pt3KR3OXtABVDfwqLj0HZjEubIypm56m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SAgv4F+/SnmnfKy5Cz/oRQQfboiC/VphNa25Fzq3s3uahQfLha4tyHrc1LltSM6bztErRSPqDp96qVTQORVHr6jqJhl6c9R0XXrnc0Pc5lpBoPKOqug1yPp15k9AAssGxtXZqg2loHjwmS+Qm1i77mNGKNhzqDpmLHEzmIejc4n4lIZmze+dLucStiNnkN6TF3nvIh37CNjH6slT5t7WfJg= diff --git a/travis_install.sh b/ci_install.sh similarity index 52% rename from travis_install.sh rename to ci_install.sh index 17da8039..c0770c48 100755 --- a/travis_install.sh +++ b/ci_install.sh @@ -8,23 +8,29 @@ npm_install() { } pio_install() { - pip install -U platformio + pip3 install -U platformio pio upgrade --dev pio platform update -p } cd code -if [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test Host" ]; then +case "$1" in +("host") pio_install -elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test WebUI" ]; then + ;; +("webui") npm_install -elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test PlatformIO Build" ]; then + ;; +("build") pio_install -elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]; then + ;; +("release") npm_install pio_install -else + ;; +(*) echo -e "\e[1;33mUnknown stage name, exiting!\e[0m" exit 1 -fi + ;; +esac diff --git a/travis_script.sh b/ci_script.sh similarity index 51% rename from travis_script.sh rename to ci_script.sh index 80f2b538..acb5c40c 100755 --- a/travis_script.sh +++ b/ci_script.sh @@ -4,16 +4,22 @@ set -x -e -v cd code -if [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test Host" ]; then +case "$1" in +("host") cd test/ && pio test -elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test WebUI" ]; then + ;; +("webui") ./build.sh -f environments -elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test PlatformIO Build" ]; then + ;; +("build") # shellcheck disable=SC2086 scripts/test_build.py -e "$TEST_ENV" $TEST_EXTRA_ARGS -elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]; then + ;; +("release") ./build.sh -r -else + ;; +(*) echo -e "\e[1;33mUnknown stage name, exiting!\e[0m" exit 1 -fi + ;; +esac diff --git a/code/scripts/test_build.py b/code/scripts/test_build.py index b3606af8..9669045f 100755 --- a/code/scripts/test_build.py +++ b/code/scripts/test_build.py @@ -62,7 +62,7 @@ def run_configurations(args, configurations): cmd.extend(["-e", args.environment]) for cfg in configurations: - print(clr(Color.BOLD, "> Building {}".format(cfg))) + print(clr(Color.BOLD, "> Building {}".format(cfg)), flush=True) with open(args.custom_h, "w") as custom_h: def write(line): @@ -100,7 +100,8 @@ def run_configurations(args, configurations): ).st_size, datetime.timedelta(seconds=diff), ), - ) + ), + flush=True, )