From 1ff94384a7f65d6ec982bdb29436f46c517df758 Mon Sep 17 00:00:00 2001 From: sean <1026025056@qq.com> Date: Mon, 31 Jul 2023 11:17:18 +0800 Subject: [PATCH] add workflows arduino lint and update compile.sh --- .github/actions/arduino-test-compile.sh | 21 +++++++++++++++++++++ .github/workflows/Arduino-Lint-Check.yml | 17 +++++++++++++++++ README.md | 1 + README_cn.md | 4 ++++ examples/Unit/KEY/KEY.ino | 4 ++-- examples/Unit/LIMIT/LIMIT.ino | 4 ++-- 6 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/Arduino-Lint-Check.yml diff --git a/.github/actions/arduino-test-compile.sh b/.github/actions/arduino-test-compile.sh index 4172c4c..d8a16fd 100755 --- a/.github/actions/arduino-test-compile.sh +++ b/.github/actions/arduino-test-compile.sh @@ -171,6 +171,27 @@ if [[ -f $GITHUB_WORKSPACE/library.properties ]]; then fi fi +if [[ -f $GITHUB_WORKSPACE/library.properties ]]; then + OLD_IFS="$IFS" + IFS=$'\n' + for line in `cat $GITHUB_WORKSPACE/library.properties` + do + result=$(echo $line | grep "depends=") + if [[ "$result" != "" ]] + then + depends_str=${line##*depends=} + IFS="," + for lib in ${depends_str[@]} + do + echo "download $lib" + arduino-cli lib install $lib + done; + fi + done + IFS="$OLD_IFS" +fi + + # # Update index and install the required board platform # diff --git a/.github/workflows/Arduino-Lint-Check.yml b/.github/workflows/Arduino-Lint-Check.yml new file mode 100644 index 0000000..8dbc060 --- /dev/null +++ b/.github/workflows/Arduino-Lint-Check.yml @@ -0,0 +1,17 @@ +name: Arduino Lint +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + lint: + name: Lint Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: arduino/arduino-lint-action@v1 + with: + library-manager: update + compliance: strict + project-type: all \ No newline at end of file diff --git a/README.md b/README.md index 5b56aad..eae4538 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ # M5Paper Library [![Arduino Compile](https://github.com/m5stack/M5EPD/actions/workflows/arduino-action-paper-compile.yml/badge.svg)](https://github.com/m5stack/M5EPD/actions/workflows/arduino-action-paper-compile.yml) +[![Arduino Lint](https://github.com/m5stack/M5EPD/actions/workflows/Arduino-Lint-Check.yml/badge.svg)](https://github.com/m5stack/M5EPD/actions/workflows/Arduino-Lint-Check.yml) [![Clang Format](https://github.com/m5stack/M5EPD/actions/workflows/clang-format-check.yml/badge.svg)](https://github.com/m5stack/M5EPD/blob/main/.github/workflows/clang-format-check.yml) diff --git a/README_cn.md b/README_cn.md index e4715e2..828163a 100644 --- a/README_cn.md +++ b/README_cn.md @@ -1,5 +1,9 @@ # M5Paper Library +[![Arduino Compile](https://github.com/m5stack/M5EPD/actions/workflows/arduino-action-paper-compile.yml/badge.svg)](https://github.com/m5stack/M5EPD/actions/workflows/arduino-action-paper-compile.yml) +[![Arduino Lint](https://github.com/m5stack/M5EPD/actions/workflows/Arduino-Lint-Check.yml/badge.svg)](https://github.com/m5stack/M5EPD/actions/workflows/Arduino-Lint-Check.yml) +[![Clang Format](https://github.com/m5stack/M5EPD/actions/workflows/clang-format-check.yml/badge.svg)](https://github.com/m5stack/M5EPD/blob/main/.github/workflows/clang-format-check.yml) + [English](README.md) | 中文 ![M5Paper_Pic_01](https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/product_jpg/assets/img/product_pics/core/m5paper/m5paper_01.jpg) diff --git a/examples/Unit/KEY/KEY.ino b/examples/Unit/KEY/KEY.ino index 1b8ae0c..94b989b 100644 --- a/examples/Unit/KEY/KEY.ino +++ b/examples/Unit/KEY/KEY.ino @@ -34,13 +34,13 @@ void changeLedColor(); void setup() { M5.begin(); // Init M5Stack 初始化M5Stack M5.EPD.SetRotation( - 90); // Set the rotation of the display. 设置屏幕旋转角度 + 90); // Set the rotation of the display. 设置屏幕旋转角度 M5.EPD.Clear(true); // Clear the screen. 清屏 M5.RTC.begin(); // Init the RTC. 初始化 RTC canvas.createCanvas(540, 960); // Create a canvas. 创建画布 canvas.setTextSize(3); // Set the text size. 设置文字大小 canvas.drawString("UNIT-KEY Example", 135, - 350); // Draw a string. 绘制字符串 + 350); // Draw a string. 绘制字符串 canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); // Update the screen. 更新屏幕 pinMode(KEY_PIN, INPUT_PULLUP); // Init Key pin. 初始化Key引脚. diff --git a/examples/Unit/LIMIT/LIMIT.ino b/examples/Unit/LIMIT/LIMIT.ino index 78600fe..5377955 100644 --- a/examples/Unit/LIMIT/LIMIT.ino +++ b/examples/Unit/LIMIT/LIMIT.ino @@ -22,13 +22,13 @@ M5EPD_Canvas canvas(&M5.EPD); void setup() { M5.begin(); // Init M5Stack 初始化M5Stack M5.EPD.SetRotation( - 90); // Set the rotation of the display. 设置屏幕旋转角度 + 90); // Set the rotation of the display. 设置屏幕旋转角度 M5.EPD.Clear(true); // Clear the screen. 清屏 M5.RTC.begin(); // Init the RTC. 初始化 RTC canvas.createCanvas(540, 960); // Create a canvas. 创建画布 canvas.setTextSize(3); // Set the text size. 设置文字大小 canvas.drawString("UNIT-LIMIT Example", 110, - 350); // Draw a string. 绘制字符串 + 350); // Draw a string. 绘制字符串 canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); // Update the screen. 更新屏幕 Serial.begin(115200);