From 6268f7d6c60535b659d7d428b8f80316768996b1 Mon Sep 17 00:00:00 2001 From: Mario Lukas Date: Sat, 16 Sep 2023 12:27:15 +0200 Subject: [PATCH] - chore(actions): added github actions for build on PR --- .github/act/pullrequest.json | 12 +++++++ .github/act/push.json | 5 +++ .github/act/tag.json | 5 +++ .github/workflows/build_arduino.yml | 54 +++++++++++++++++++++++++++++ .github/workflows/build_pio.yml | 43 +++++++++++++++++++++++ 5 files changed, 119 insertions(+) create mode 100644 .github/act/pullrequest.json create mode 100644 .github/act/push.json create mode 100644 .github/act/tag.json create mode 100644 .github/workflows/build_arduino.yml create mode 100644 .github/workflows/build_pio.yml diff --git a/.github/act/pullrequest.json b/.github/act/pullrequest.json new file mode 100644 index 0000000..55e1f25 --- /dev/null +++ b/.github/act/pullrequest.json @@ -0,0 +1,12 @@ +{ + "action": "opened", + "number": 1, + "pull_request": { + "base": { + "ref": "main" + }, + "head": { + "ref": "feature-branch" + } + } +} \ No newline at end of file diff --git a/.github/act/push.json b/.github/act/push.json new file mode 100644 index 0000000..45bc8f8 --- /dev/null +++ b/.github/act/push.json @@ -0,0 +1,5 @@ +{ + "push": { + "ref": "refs/tags/v.0.2.0" + } +} \ No newline at end of file diff --git a/.github/act/tag.json b/.github/act/tag.json new file mode 100644 index 0000000..345bacb --- /dev/null +++ b/.github/act/tag.json @@ -0,0 +1,5 @@ +{ + "push": { + "ref": "refs/master" + } +} \ No newline at end of file diff --git a/.github/workflows/build_arduino.yml b/.github/workflows/build_arduino.yml new file mode 100644 index 0000000..0c48daf --- /dev/null +++ b/.github/workflows/build_arduino.yml @@ -0,0 +1,54 @@ +name: Build Bluetti ESP32 Bridge with Arduino IDE +on: + push: + branches: + - main + pull_request: + types: + - opened + workflow_run: + workflows: ["Build with Arduino on PR Request"] + types: + - completed + branches: + - main # Change this to the branch you want to trigger the build on + - +jobs: + build-firmware: + runs-on: ubuntu-latest + + steps: + + - name: 🏗 Install build dependencies + run: sudo apt-get -qq update && sudo apt-get -y install build-essential curl python3-serial + + - name: ⬇ Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + + - name: Install Arduino CLI + run: curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh + + - name: Install platform + run: | + arduino-cli core update-index + arduino-cli core install esp32:esp32 + + - name: Install Platform + run: | + arduino-cli lib install WiFiManager + arduino-cli lib install PubSubClient + export ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true && arduino-cli lib install --git-url https://github.com/me-no-dev/AsyncTCP.git + export ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true && arduino-cli lib install --git-url https://github.com/me-no-dev/ESPAsyncWebServer.git + export ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true && arduino-cli lib install --git-url https://github.com/h2zero/NimBLE-Arduino.git + arduino-cli lib install AsyncElegantOTA + arduino-cli lib install "Adafruit SSD1306" + arduino-cli lib install "Adafruit GFX Library" + arduino-cli lib install "Adafruit BusIO" + + - name: 🔨 Build Firmware + run: | + cd Bluetti_ESP32 + arduino-cli compile --fqbn esp32:esp32:esp32 Bluetti_ESP32.ino \ No newline at end of file diff --git a/.github/workflows/build_pio.yml b/.github/workflows/build_pio.yml new file mode 100644 index 0000000..2012b66 --- /dev/null +++ b/.github/workflows/build_pio.yml @@ -0,0 +1,43 @@ +name: Build Bluetti ESP32 Bridge with PlatformIO + +on: + push: + branches: + - main + pull_request: + types: + - opened + workflow_run: + workflows: ["Build with PlatformIO on PR Request"] + types: + - completed + branches: + - main # Change this to the branch you want to trigger the build on + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' # Set the desired Python version + + - name: Install PlatformIO + run: | + pip install -U platformio + platformio platform install espressif32 + + - name: Build ESP32 Program + run: | + platformio run + +# - name: Upload artifacts +# uses: actions/upload-artifact@v2 +# with: +# name: firmware # Set the name of the artifact directory +# path: .pio/build/ # Replace with your PlatformIO environment name