mirror of
https://github.com/emqx/neuron.git
synced 2026-10-18 21:50:42 +08:00
937bfc90e4
The base docker image had already install dependent libraries, so we remove the statement of calling install-libs.sh in dockerfile
153 lines
3.7 KiB
YAML
153 lines
3.7 KiB
YAML
name: EMQX Neuron dev workflow
|
|
|
|
on: [push, pull_request, release ]
|
|
|
|
jobs:
|
|
clang_format_check:
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
# checkout
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Run clang-format style check for C/C++ programs.
|
|
uses: DoozyX/clang-format-lint-action@v0.12
|
|
with:
|
|
source: 'src plugins include tests'
|
|
exclude: 'include/vector.h'
|
|
clangFormatVersion: 10
|
|
style: file
|
|
|
|
function_test:
|
|
runs-on: ubuntu-18.04
|
|
|
|
container: ghcr.io/${{ github.repository }}/base:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Start neuron
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
cmake .. && make
|
|
|
|
- name: Run function test
|
|
run: |
|
|
pip3 install robotframework
|
|
pip3 install RESTinstance
|
|
pip3 install robotframework-mqttlibrary
|
|
python3 -m robot -P ft/ -d ft/reports ft
|
|
|
|
#- uses: actions/upload-artifact@v2
|
|
#with:
|
|
#name: ft-output
|
|
#path: "ft/reports/output.xml"
|
|
|
|
#- uses: actions/upload-artifact@v2
|
|
#with:
|
|
#name: ft-log
|
|
#path: "ft/reports/log.html"
|
|
|
|
#- uses: actions/upload-artifact@v2
|
|
#with:
|
|
#name: ft-report
|
|
#path: "ft/reports/report.html"
|
|
compile:
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- "arm-linux-gnueabihf"
|
|
- "aarch64-linux-gnu"
|
|
- "x86_64-linux-gnu"
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
container: ghcr.io/${{ github.repository }}/base:latest
|
|
|
|
steps:
|
|
# checkout
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Compile
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/${{ matrix.arch }}.cmake
|
|
make
|
|
|
|
- name: Run unit test
|
|
if: matrix.arch == 'x86_64-linux-gnu'
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
# cmake .. -DNEURON_TEST=ON
|
|
ctest --output-on-failure
|
|
|
|
- name: Create package
|
|
env:
|
|
ARCH: ${{ matrix.arch }}
|
|
run: |
|
|
./package.sh -p ${ARCH} -n neuron-${GITHUB_REF##*/}-${ARCH%%-*}.tar.gz
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.arch }}
|
|
path: "*.tar.gz"
|
|
|
|
run_neuron:
|
|
needs: compile
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- "arm-linux-gnueabihf"
|
|
- "aarch64-linux-gnu"
|
|
- "x86_64-linux-gnu"
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.arch }}
|
|
path: neuron.tar.gz
|
|
|
|
- uses: docker/setup-buildx-action@v1
|
|
- uses: docker/setup-qemu-action@v1
|
|
with:
|
|
image: tonistiigi/binfmt:latest
|
|
platforms: all
|
|
|
|
- name: Run neuron
|
|
run: |
|
|
case ${{ matrix.arch }} in
|
|
"arm-linux-gnueabihf")
|
|
platform="linux/arm/v7"
|
|
;;
|
|
"aarch64-linux-gnu")
|
|
platform="linux/arm64"
|
|
;;
|
|
"x86_64-linux-gnu")
|
|
platform="linux/amd64"
|
|
;;
|
|
esac
|
|
docker run -d --name neuron \
|
|
-v $(pwd)/neuron.tar.gz:/opt/neuron.tar.gz \
|
|
-p 7001:7001 \
|
|
--platform ${platform} \
|
|
ubuntu:18.04 \
|
|
bash -c "tar -zxvf neuron.tar.gz -C /opt && cd /opt/neuron && ./neuron"
|
|
|
|
- name: Check status
|
|
timeout-minutes: 1
|
|
run: |
|
|
if ! curl --silent --show-error -X POST http://127.0.0.1:7001/api/v2/ping > /dev/null; then
|
|
sleep 1
|
|
fi
|