replace travis with GitHub Actions close #626 (#629)

added GitHub Actions to documentation
This commit is contained in:
Leon Kiefer
2020-06-13 01:44:34 +02:00
committed by GitHub
parent 1e10783a28
commit 95a3f8e0b6
8 changed files with 121 additions and 93 deletions

View File

@@ -31,6 +31,6 @@ If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
* You should not have a compilation error if you use the versions of the libraries linked into the libraries folder, this badges show you the state of the compilation
[![Build Status](https://travis-ci.com/1technophile/OpenMQTTGateway.svg?branch=master)](https://travis-ci.com/1technophile/OpenMQTTGateway)
[![Build Status](https://github.com/1technophile/OpenMQTTGateway/workflows/Build/badge.svg?branch=master)](https://github.com/1technophile/OpenMQTTGateway/actions)
* If you are not sure this is a bug or an enhancement post your question to the forum below
[![Community forum](https://img.shields.io/badge/community-forum-brightgreen.svg)](https://community.openmqttgateway.com)

34
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
name: Build with PlatformIO
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install platformio
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Run PlatformIO
run: platformio run
documentation:
runs-on: ubuntu-latest
name: Create the documentation
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
- name: Install vuepress
run: npm install -g vuepress
- name: Build documentation
run: npm run docs:build

62
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: Release
on:
release:
types: [published]
jobs:
build-upload:
runs-on: ubuntu-latest
name: Build and upload Assets to Release
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install platformio
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Set version tag from git
run: sed -i "s/version_tag/${GITHUB_REF#refs/tags/}/g" main/User_config.h
- name: Run PlatformIO
run: platformio run
- name: Prepare Release Assets
run: |
sudo apt install rename
./scripts/prepare_deploy.sh
- name: Get upload url
id: release-id
run: |
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
echo "::set-output name=upload_url::https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets{?name,label}"
- name: Upload Release Assets
uses: bgpat/release-asset-action@03b0c30db1c4031ce3474740b0e4275cd7e126a3
with:
pattern: "toDeploy/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.release-id.outputs.upload_url }}
allow-overwrite: true
documentation:
runs-on: ubuntu-latest
name: Create the documentation and deploy it to GitHub Pages
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
- name: Install vuepress
run: npm install -g vuepress
- name: Set version tag from git
run: sed -i "s/version_tag/${GITHUB_REF#refs/tags/}/g" docs/.vuepress/config.js
- name: Build documentation
run: npm run docs:build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vuepress/dist
cname: docs.openmqttgateway.com

View File

@@ -1,73 +0,0 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < https://docs.platformio.org/page/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < https://docs.platformio.org/page/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
#
#
# Please choose one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
jobs:
include:
- name: "Build and deploy with PlatformIO"
language: python
python: 2.7
cache:
directories:
- "~/.platformio"
install:
- pip install -U platformio
- platformio update
script:
- sed -i 's/version_tag/'$TRAVIS_TAG'/g' main/User_config.h
- platformio run
- bash scripts/prepare_deploy.sh
before_deploy: ls -a
deploy:
on:
repo: 1technophile/OpenMQTTGateway
all_branches: true
tags: true
provider: releases
overwrite: true
api_key: $GITHUB_TOKEN
file_glob: true
file:
- toDeploy/*
skip_cleanup: true
- name: "Build and deploy docs"
language: node_js
node_js:
- lts/*
install:
- npm install -g vuepress
script:
- sed -i 's/version_tag/'$TRAVIS_TAG'/g' docs/.vuepress/config.js
- npm run docs:build
before_deploy: echo "docs.openmqttgateway.com" >> docs/.vuepress/dist/CNAME
deploy:
provider: pages
skip_cleanup: true
local_dir: docs/.vuepress/dist
github_token: $GITHUB_TOKEN # a token generated on github allowing travis to push code on you repository
keep_history: true
on:
repo: 1technophile/OpenMQTTGateway
all_branches: true
tags: true

View File

@@ -1,5 +1,5 @@
[![Community forum](https://img.shields.io/badge/community-forum-brightgreen.svg)](https://community.openmqttgateway.com)
[![Build Status](https://travis-ci.com/1technophile/OpenMQTTGateway.svg?branch=master)](https://travis-ci.com/1technophile/OpenMQTTGateway)
[![Build Status](https://github.com/1technophile/OpenMQTTGateway/workflows/Build/badge.svg?branch=master)](https://github.com/1technophile/OpenMQTTGateway/actions)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/943c9b639b68441dae8e29ee39977ab2)](https://www.codacy.com/app/1technophile/OpenMQTTGateway?utm_source=github.com&utm_medium=referral&utm_content=1technophile/OpenMQTTGateway&utm_campaign=badger)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/1technophile/openmqttgateway.svg)](http://isitmaintained.com/project/1technophile/openmqttgateway "Percentage of issues still open")
[![GitLicense](https://gitlicense.com/badge/1technophile/OpenMQTTGateway)](https://gitlicense.com/license/1technophile/OpenMQTTGateway)

View File

@@ -3,7 +3,7 @@
I like pull requests from everyone. By participating in this project, you
agree to follow the code of conduct below
[code of conduct]: https://github.com/1technophile/OpenMQTTGateway/blob/master/CODE_OF_CONDUCT.md
[code of conduct](https://github.com/1technophile/OpenMQTTGateway/blob/master/CODE_OF_CONDUCT.md)
[code style guide](https://google.github.io/styleguide/cppguide.html#Formatting)
@@ -16,7 +16,7 @@ Make your modification,
Review your code, compile it for Arduino Uno and ESP8266
Test it localy on your hardware config
Test it locally on your hardware config
If you modify `User_config.h` during your developments you need to report your modifications into Test_config.h
https://github.com/1technophile/OpenMQTTGateway/blob/master/tests/Test_config.h
@@ -25,7 +25,7 @@ Indeed during the continuous integration process `User_config.h` is replaced by
Emit a pull request
Verify the travis CI compilation results
Verify the GitHub Actions CI compilation results
Request for review

View File

@@ -1,8 +1,10 @@
# Troubleshooting
## Compilation/build error
This badge [![Build Status](https://travis-ci.com/1technophile/OpenMQTTGateway.svg?branch=master)](https://travis-ci.com/1technophile/OpenMQTTGateway) show you the state of the compilation of the master and this one [![Build Status](https://travis-ci.com/1technophile/OpenMQTTGateway.svg?branch=development)](https://travis-ci.com/1technophile/OpenMQTTGateway) for the development branch. If you see a green badge this means that the code compilation is OK with the configuration given in the docs/platformio.ini. Check your IDE environment version, boards version, libraries version before submitting an issue or a question.
Verify especially that the libraries provided into the [the release page](https://github.com/1technophile/OpenMQTTGateway/releases) are located into your "sketchbook folder"/libraries if your are using the Arduino IDE.
This badge [![Build Status](https://github.com/1technophile/OpenMQTTGateway/workflows/Build/badge.svg?branch=master)](https://github.com/1technophile/OpenMQTTGateway/actions?query=branch%3Amaster+workflow%3ABuild) show you the state of the compilation of the master and this one [![Build Status](https://github.com/1technophile/OpenMQTTGateway/workflows/Build/badge.svg?branch=development)](https://github.com/1technophile/OpenMQTTGateway/actions?query=branch%3Adevelopment+workflow%3ABuild) for the development branch.
If you see a green badge this means that the code compilation is OK with the configuration given in the `docs/platformio.ini`.
Check your IDE environment version, boards version, libraries version before submitting an issue or a question.
Verify especially that the libraries provided into the [release page](https://github.com/1technophile/OpenMQTTGateway/releases) are located into your "sketchbook folder"/libraries if your are using the Arduino IDE.
## ESP32 compilation errors related to wifi
If you get one or several of the following errors:
@@ -29,10 +31,10 @@ Regarding the IR led emitter you can replace it with a normal led and see if it
try with D2 instead of D3
and put
define RF_RECEIVER_PIN 4 // D2 on nodemcu
`#define RF_RECEIVER_PIN 4 // D2 on nodemcu`
in config_rf.h
instead of
define RF_RECEIVER_PIN 0 // D3 on nodemcu
`#define RF_RECEIVER_PIN 0 // D3 on nodemcu`
## Exception seen on serial monitor:
Hey I got a callback

25
scripts/prepare_deploy.sh Normal file → Executable file
View File

@@ -1,19 +1,22 @@
#!/bin/bash
set -e
echo "renaming bin files with the board name"
rename -v 's:/:-:g' .pio/build/*/*.bin
mkdir toDeploy
rename 's/.pio-build-//' .*.bin
cd .pio/libdeps
echo "replace space by _ in folder names"
find . -type d -name "* *" | while read FNAME; do mv "$FNAME" "${FNAME// /_}"; done
echo "zipping libraries per board"
for i in */; do zip -r "${i%/}-libraries.zip" "$i"; done
ls -la
mv *.zip ../../toDeploy
cd ../..
(
cd .pio/libdeps
echo "replace space by _ in folder names"
find . -type d -name "* *" | while read FNAME; do mv "$FNAME" "${FNAME// /_}"; done
echo "zipping libraries per board"
for i in */; do zip -r "${i%/}-libraries.zip" "$i"; done
ls -la
mv *.zip ../../toDeploy
)
echo "zipping code and licence"
zip -r OpenMQTTGateway_sources.zip main LICENSE.txt
mv *.zip toDeploy
mv *.bin toDeploy
cd toDeploy
ls -la
cd ..
ls -lA toDeploy