From c71a150143f359c6b5da572929d00fddcc38379d Mon Sep 17 00:00:00 2001 From: David Conran Date: Sat, 10 Jul 2021 11:49:43 +1000 Subject: [PATCH] Migrate from Travis to GitHub Actions (#1526) * Move any remaining Travis processes to GitHub Actions * Remove Travis files and references. (Excluding `ReleaseNotes.md`) * Change badges as well. - Remove two defunct badges. - Add a badge per GitHub Actions workflow. Fixes #1522 --- .github/CONTRIBUTING.md | 2 +- .github/workflows/Build.yml | 37 ++++++++++ .github/workflows/Documentation.yml | 21 ++++++ .github/workflows/Lint.yml | 28 ++++++++ .github/workflows/MetaChecks.yml | 54 ++++++++++++++ .github/workflows/UnitTests.yml | 10 ++- .../arduino_library_manager_linter.yml | 34 --------- .travis.yml | 72 ------------------- README.md | 7 +- README_de.md | 8 ++- README_fr.md | 9 +-- tools/auto_analyse_raw_data.py | 5 +- tools/scrape_supported_devices.py | 4 +- 13 files changed, 168 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/Build.yml create mode 100644 .github/workflows/Documentation.yml create mode 100644 .github/workflows/Lint.yml create mode 100644 .github/workflows/MetaChecks.yml delete mode 100644 .github/workflows/arduino_library_manager_linter.yml delete mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 20bb97d94..87fd34fc1 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -71,7 +71,7 @@ Include details about your configuration, circuit and environment: * Avoid platform-dependent code. * Use c98 types where possible for better portablity. * In almost all cases, code & documentation should be peer-reviewed by at least one other contributor. -* The code should pass all the existing testing infrastructure in Travis. e.g. Unit tests, cpplint, and basic compilation. +* The code should pass all the existing testing infrastructure in GitHub Actions. e.g. Unit tests, cpplint, and basic compilation etc. * State if you have tested this under real conditions if you have, and what other tests you may have carried out. ### Git Commit Messages diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 000000000..5c0e5907c --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,37 @@ +name: Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + Build_Examples: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Cache PlatformIO + uses: actions/cache@v2 + with: + path: ~/.platformio + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + - name: Set up Python + uses: actions/setup-python@v2 + - name: Install PlatformIO + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + - name: Build all the examples + env: + PLATFORMIO_BUILD_CACHE_DIR: "../../.pio/buildcache" + run: find . -name platformio.ini -type f | sed 's,/platformio.ini$,,' | xargs --verbose -n 1 pio run --jobs 2 --project-dir diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml new file mode 100644 index 000000000..adea2b302 --- /dev/null +++ b/.github/workflows/Documentation.yml @@ -0,0 +1,21 @@ +# This is a basic workflow that is triggered on push/PRs to the master branch. + +name: Documentation + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + Doxygen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: SteffenSeckler/doxygen-action@v2.2.0beta4 + with: + fail-on-warnings: true diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml new file mode 100644 index 000000000..198e536a6 --- /dev/null +++ b/.github/workflows/Lint.yml @@ -0,0 +1,28 @@ +name: Code Lint + +on: [push] + +jobs: + Linters: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + pip install cpplint + - name: Analysing the code with pylint + run: | + shopt -s nullglob + pylint -d F0001 {src,test,tools}/*.py + - name: Analysing the code with cpplint + run: | + shopt -s nullglob + cpplint --extensions=c,cc,cpp,ino --headers=h,hpp {src,src/locale,test,tools}/*.{h,c,cc,cpp,hpp,ino} examples/*/*.{h,c,cc,cpp,hpp,ino} diff --git a/.github/workflows/MetaChecks.yml b/.github/workflows/MetaChecks.yml new file mode 100644 index 000000000..2866ffc37 --- /dev/null +++ b/.github/workflows/MetaChecks.yml @@ -0,0 +1,54 @@ +# This is a basic workflow that is triggered on push/PRs to the master branch. + +name: Library Linter + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + arduino-library-manager-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: arduino/arduino-lint-action@v1 + with: + library-manager: update + compliance: strict + # Detect case-insensitive file duplication in the same directory. + # This can cause a problem for the Arduino IDE on Windows & Macs. + # See: + # - https://github.com/arduino/Arduino/issues/11441 + # - https://github.com/crankyoldgit/IRremoteESP8266/issues/1451 + detect-duplicate-files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Look for case-insensitive filename collisions. + run: DUPS=$(find . -path '*/.pio' -prune -o -print | sort | uniq -D -i); if [[ -n "${DUPS}" ]]; then echo -e "Duplicates found:\n${DUPS}"; false; fi + version-number-consitent: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check all the version numbers match. + run: | + LIB_VERSION=$(egrep "^#define\s+_IRREMOTEESP8266_VERSION_\s+" src/IRremoteESP8266.h | cut -d\" -f2) + test ${LIB_VERSION} == "$(jq -r .version library.json)" + grep -q "^version=${LIB_VERSION}$" library.properties + examples-have-platformio_ini: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check that every example directory has a platformio.ini file. + run: (status=0; for dir in examples/*; do if [[ ! -f "${dir}/platformio.ini" ]]; then echo "${dir} has no 'platform.ini' file!"; status=1; fi; done; exit ${status}) + supported-devices-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check that all files have supported sections. + run: (SUPPORTED_OUTPUT=$(python3 tools/scrape_supported_devices.py --noout --alert 2>&1); if [[ $? -ne 0 || -n "${SUPPORTED_OUTPUT}" ]]; then echo "${SUPPORTED_OUTPUT}"; exit 1; fi) diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml index 0245bdb34..699038e88 100644 --- a/.github/workflows/UnitTests.yml +++ b/.github/workflows/UnitTests.yml @@ -1,4 +1,4 @@ -name: Unit tests +name: Tests on: push: @@ -14,8 +14,14 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install the Google test suite + env: + MAKEFLAGS: "-j 2" run: (cd test; make install-googletest) - name: Build and run the library unit tests. + env: + MAKEFLAGS: "-j 2" run: (cd test; make run) - name: Build and run the tools unit tests. - run: (cd tools; make run_tests) + env: + MAKEFLAGS: "-j 2" + run: (cd tools; make all; make run_tests) diff --git a/.github/workflows/arduino_library_manager_linter.yml b/.github/workflows/arduino_library_manager_linter.yml deleted file mode 100644 index 8a2f90b91..000000000 --- a/.github/workflows/arduino_library_manager_linter.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This is a basic workflow that is triggered on push/PRs to the master branch. - -name: Arduino Library Manager Linter - -# Controls when the action will run. Workflow runs when manually triggered using the UI -# or API. -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - arduino-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: arduino/arduino-lint-action@v1 - with: - library-manager: update - compliance: strict - detect-duplicate-files: - # Detect case-insensitive file duplication in the same directory. - # This can cause a problem for the Arduino IDE on Windows & Macs. - # See: - # - https://github.com/arduino/Arduino/issues/11441 - # - https://github.com/crankyoldgit/IRremoteESP8266/issues/1451 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Look for case-insensitive filename collisions. - run: DUPS=$(find . -path '*/.pio' -prune -o -print | sort | uniq -D -i); if [[ -n "${DUPS}" ]]; then echo -e "Duplicates found:\n${DUPS}"; false; fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0b8bf6e16..000000000 --- a/.travis.yml +++ /dev/null @@ -1,72 +0,0 @@ -dist: bionic -language: c -addons: - apt: - packages: - - jq - - doxygen - - graphviz - - python3.8 - - python3-pip - - pylint3 - - python3-setuptools -env: - - PLATFORMIO_BUILD_CACHE_DIR="../../.pio/buildcache" - IRRECVDUMP_RE=".*IRrecvDumpV.*" - IRMQTTSERVER_RE=".*IRMQTTServer.*" - MAKEFLAGS="-j 2" -cache: - directories: - - "~/.platformio" -before_install: - - wget https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py - - python --version && pip --version - - python3 --version && pip3 --version - - sudo pip3 install -U platformio - - pio update -script: echo Running checks -notifications: - email: - on_success: change - on_failure: change -jobs: - include: - - name: "Compile the trivial examples" - script: - # Check that everything compiles but some heavy tasks e.g. IRMQTTServer & IRrecvDumpV2+ - # i.e. We are splitting the work load in to parallel tasks. - - find . -regextype egrep -name platformio.ini -type f \! -regex "${IRRECVDUMP_RE}|${IRMQTTSERVER_RE}" | sed 's,/platformio.ini$,,' | xargs --verbose -n 1 pio run --jobs 2 --project-dir - - name: "Compile the IRrecvDumpV2+ examples" - script: - # Check that IRrecvDumpV2+ compiles. - # i.e. We are splitting the work load in to parallel tasks. - - find . -regextype egrep -name platformio.ini -type f -regex "${IRRECVDUMP_RE}" | sed 's,/platformio.ini$,,' | xargs --verbose -n 1 pio run --jobs 2 --project-dir - - name: "Unit tests, Linter, Doc checks, & Compile IRMQTTServer" - script: - # Run all the Tests & check the code linters have no issues, and that - # IRMQTTServer compiles. - # i.e. We are splitting the work load in to parallel tasks. - # Check the version numbers match. - - LIB_VERSION=$(egrep "^#define\s+_IRREMOTEESP8266_VERSION_\s+" src/IRremoteESP8266.h | cut -d\" -f2) - - test ${LIB_VERSION} == "$(jq -r .version library.json)" - - grep -q "^version=${LIB_VERSION}$" library.properties - # Check the tools programs compile. - - (cd tools; make all) - # Check for lint issues. - - shopt -s nullglob - - python cpplint.py --extensions=c,cc,cpp,ino --headers=h,hpp {src,src/locale,test,tools}/*.{h,c,cc,cpp,hpp,ino} examples/*/*.{h,c,cc,cpp,hpp,ino} - - pylint3 -d F0001 {src,test,tools}/*.py - - shopt -u nullglob - # Install the Google test suite. - - (cd test; make install-googletest) - # Build and run the unit tests. - - (cd test; make run) - - (cd tools; make run_tests) - # Check that every example directory has a platformio.ini file. - - (status=0; for dir in examples/*; do if [[ ! -f "${dir}/platformio.ini" ]]; then echo "${dir} has no 'platform.ini' file!"; status=1; fi; done; exit ${status}) - # Check that doxygen completes without errors or warnings. - - (DOXYGEN_OUTPUT=$(doxygen 2>&1); if [[ $? -ne 0 || -n "${DOXYGEN_OUTPUT}" ]]; then echo "${DOXYGEN_OUTPUT}"; exit 1; fi) - # Check that all files has supported sections. - - (SUPPORTED_OUTPUT=$(python3 tools/scrape_supported_devices.py --noout --alert 2>&1); if [[ $? -ne 0 || -n "${SUPPORTED_OUTPUT}" ]]; then echo "${SUPPORTED_OUTPUT}"; exit 1; fi) - # Check that IRMQTTServer compiles. - - find . -regextype egrep -name platformio.ini -type f -regex "${IRMQTTSERVER_RE}" | sed 's,/platformio.ini$,,' | xargs --verbose -n 1 pio run --jobs 2 --project-dir diff --git a/README.md b/README.md index de007d9c8..8f563b01e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ ![IRremoteESP8266 Library](./assets/images/banner.svg) -[![Build Status](https://travis-ci.com/crankyoldgit/IRremoteESP8266.svg?branch=master)](https://travis-ci.com/crankyoldgit/IRremoteESP8266) +[![Build Status](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Build.yml/badge.svg)](../../actions/workflows/Build.yml) +[![Code Lint](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Lint.yml/badge.svg)](../../actions/workflows/Lint.yml) +[![Tests](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/UnitTests.yml/badge.svg)](../../actions/workflows/UnitTests.yml) +[![Documentation](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Documentation.yml/badge.svg)](../../actions/workflows/Documentation.yml/badge.svg) [![arduino-library-badge](https://www.ardu-badge.com/badge/IRremoteESP8266.svg?)](https://www.ardu-badge.com/IRremoteESP8266) -[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/crankyoldgit/IRremoteESP8266.svg)](http://isitmaintained.com/project/crankyoldgit/IRremoteESP8266 "Average time to resolve an issue") -[![Percentage of issues still open](http://isitmaintained.com/badge/open/crankyoldgit/IRremoteESP8266.svg)](http://isitmaintained.com/project/crankyoldgit/IRremoteESP8266 "Percentage of issues still open") [![GitLicense](https://gitlicense.com/badge/crankyoldgit/IRremoteESP8266)](https://gitlicense.com/license/crankyoldgit/IRremoteESP8266) This library enables you to **send _and_ receive** infra-red signals on an [ESP8266](https://github.com/esp8266/Arduino) or an diff --git a/README_de.md b/README_de.md index 690ce281a..d7cc16a7a 100644 --- a/README_de.md +++ b/README_de.md @@ -1,9 +1,11 @@ ![IRremoteESP8266 Library](./assets/images/banner.svg) -[![Build-Status](https://travis-ci.com/crankyoldgit/IRremoteESP8266.svg?branch=master)](https://travis-ci.com/crankyoldgit/IRremoteESP8266) +[![Build-Status](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Build.yml/badge.svg)](../../actions/workflows/Build.yml/badge.svg) +[![Code-Lint](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Lint.yml/badge.svg)](../../actions/workflows/Lint.yml) +[![Tests](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/UnitTests.yml/badge.svg)](../../ctions/workflows/UnitTests.yml) +[![Dokumentation](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Documentation.yml/badge.svg)](../../actions/workflows/Documentation.yml) +[![arduino-library-badge](https://www.ardu-badge.com/badge/IRremoteESP8266.svg?)](https://www.ardu-badge.com/IRremoteESP8266) [![Arduino-Bibliothek-Abzeichen](https://www.ardu-badge.com/badge/IRremoteESP8266.svg?)](https://www.ardu-badge.com/IRremoteESP8266) -[![Durchschnittliche Zeit bis zur Problemlösung](http://isitmaintained.com/badge/resolution/crankyoldgit/IRremoteESP8266.svg)](http://isitmaintained.com/project/crankyoldgit/IRremoteESP8266 "Resolution Time") -[![Prozentsatz der offenen Probleme](http://isitmaintained.com/badge/open/crankyoldgit/IRremoteESP8266.svg)](http://isitmaintained.com/project/crankyoldgit/IRremoteESP8266 "Open issues") [![Git-Lizenz](https://gitlicense.com/badge/crankyoldgit/IRremoteESP8266)](https://gitlicense.com/license/crankyoldgit/IRremoteESP8266) Diese Programmbibliothek ermöglicht das **Senden _und_ Empfangen** von Infrarotsignalen mit [ESP8266](https://github.com/esp8266/Arduino)- und diff --git a/README_fr.md b/README_fr.md index c87ab75cf..c46bd2750 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,11 @@ ![IRremoteESP8266 Library](./assets/images/banner.svg) -[![Build Status](https://travis-ci.com/crankyoldgit/IRremoteESP8266.svg?branch=master)](https://travis-ci.com/crankyoldgit/IRremoteESP8266) +[![Construire](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Build.yml/badge.svg)](../../actions/workflows/Build.yml) +[![Charbon de code](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Lint.yml/badge.svg)](../../actions/workflows/Lint.yml) +[![Essais](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/UnitTests.yml/badge.svg)](../../actions/workflows/UnitTests.yml) +[![Documentation](https://github.com/crankyoldgit/IRremoteESP8266/actions/workflows/Documentation.yml/badge.svg)](../../actions/workflows/Documentation.yml) [![arduino-library-badge](https://www.ardu-badge.com/badge/IRremoteESP8266.svg?)](https://www.ardu-badge.com/IRremoteESP8266) -[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/crankyoldgit/IRremoteESP8266.svg)](http://isitmaintained.com/project/crankyoldgit/IRremoteESP8266 "Average time to resolve an issue") -[![Percentage of issues still open](http://isitmaintained.com/badge/open/crankyoldgit/IRremoteESP8266.svg)](http://isitmaintained.com/project/crankyoldgit/IRremoteESP8266 "Percentage of issues still open") -[![GitLicense](https://gitlicense.com/badge/crankyoldgit/IRremoteESP8266)](https://gitlicense.com/license/crankyoldgit/IRremoteESP8266) +[![LicenseGit](https://gitlicense.com/badge/crankyoldgit/IRremoteESP8266)](https://gitlicense.com/license/crankyoldgit/IRremoteESP8266) Cette librairie vous permetra de **recevoir et d'envoyer des signaux** infrarouge sur le protocole [ESP8266](https://github.com/esp8266/Arduino) ou sur le protocole [ESP32](https://github.com/espressif/arduino-esp32) en utilisant le [Arduino framework](https://www.arduino.cc/) qui utilise la norme 940nm IR LEDs et le module basique de reception d'onde IR. Exemple : TSOP{17,22,24,36,38,44,48}* modules etc. diff --git a/tools/auto_analyse_raw_data.py b/tools/auto_analyse_raw_data.py index 3b22ea12d..15587d294 100755 --- a/tools/auto_analyse_raw_data.py +++ b/tools/auto_analyse_raw_data.py @@ -303,9 +303,10 @@ def convert_rawdata(data_str): for timing in [x.strip() for x in data_str.split(',')]: try: results.append(int(timing)) - except ValueError: + except ValueError as non_numeric: raise ValueError( - "Raw Data contains a non-numeric value of '%s'." % timing) + "Raw Data contains a non-numeric value of '%s'." % + timing) from non_numeric return results diff --git a/tools/scrape_supported_devices.py b/tools/scrape_supported_devices.py index a9cd10f0a..8c12bc5f7 100755 --- a/tools/scrape_supported_devices.py +++ b/tools/scrape_supported_devices.py @@ -93,9 +93,9 @@ def getallacs(): match = IRSEND_FN_RE.match(path.name) if match: rawmodels = getenums(path) - for acprotocol in rawmodels: + for acprotocol, acmodels in rawmodels.items(): models = set() - for model in rawmodels[acprotocol]: + for model in acmodels: model = model.upper() model = model.replace("K{}".format(acprotocol.upper()), "") if model and model not in EXCLUDED_PROTOCOLS: