mirror of
https://github.com/emqx/neuron.git
synced 2026-10-17 04:40:42 +08:00
262 lines
7.6 KiB
YAML
262 lines
7.6 KiB
YAML
name: compile
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
env:
|
|
VERSION: 2.4.13
|
|
UI_VERSION: 2.4.8
|
|
BRANCH: v2.4
|
|
|
|
jobs:
|
|
cross-build:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- [aarch64-linux-gnu, aarch64, arm64]
|
|
- [arm-linux-gnueabihf, armv4, armhf]
|
|
- [x86_64-linux-gnu, x86_64, amd64]
|
|
container: ghcr.io/neugates/build:${{ matrix.arch[1] }}-v2.4
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: compile
|
|
run: |
|
|
git config --global --add safe.directory $(pwd)
|
|
mkdir -p build && cd build
|
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/${{ matrix.arch[0] }}.cmake \
|
|
-DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON
|
|
make -j4
|
|
|
|
- name: fetch dashboard
|
|
uses: dsaltares/fetch-gh-release-asset@master
|
|
with:
|
|
repo: "emqx/neuron-dashboard-src"
|
|
version: "tags/${{ env.UI_VERSION }}"
|
|
file: "neuron-dashboard.zip"
|
|
target: "neuron-dashboard.zip"
|
|
|
|
- name: unpack dashboard
|
|
run: |
|
|
unzip neuron-dashboard.zip -d ./build
|
|
|
|
- name: Create neuron sdk package
|
|
run: |
|
|
./package-sdk.sh -p ${{ matrix.arch[2] }} -n neuron-sdk-$VERSION
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: neuron-sdk-${{ matrix.arch[2] }}
|
|
path: |
|
|
neuron-sdk-*.tar.gz
|
|
|
|
build-debug-sdk:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- [x86_64-linux-gnu, x86_64, amd64]
|
|
container: ghcr.io/neugates/build:${{ matrix.arch[1] }}-v2.4
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: compile
|
|
run: |
|
|
git config --global --add safe.directory $(pwd)
|
|
mkdir -p build && cd build
|
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/${{ matrix.arch[0] }}.cmake \
|
|
-DDISABLE_UT=ON
|
|
make -j4
|
|
|
|
- name: Create neuron sdk package
|
|
run: |
|
|
./package-sdk.sh -p ${{ matrix.arch[2] }} -n neuron-sdk-debug-$VERSION
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: neuron-sdk-debug-${{ matrix.arch[2] }}
|
|
path: |
|
|
neuron-sdk-debug-*.tar.gz
|
|
|
|
create_daily_release:
|
|
runs-on: ubuntu-20.04
|
|
if: github.event_name == 'push'
|
|
needs: [cross-build, build-debug-sdk]
|
|
|
|
steps:
|
|
- name: delete old daily-pre-release
|
|
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
|
with:
|
|
delete_release: true
|
|
tag_name: ${{ env.BRANCH }}-daily
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: create daily-pre-release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.BRANCH }}-daily
|
|
release_name: Daily Release(${{ env.BRANCH }})
|
|
draft: false
|
|
prerelease: true
|
|
|
|
- shell: bash
|
|
run: |
|
|
echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: release_url
|
|
path: release_url.txt
|
|
|
|
upload_daily_release_asset:
|
|
runs-on: ubuntu-20.04
|
|
if: github.event_name == 'push'
|
|
needs: create_daily_release
|
|
strategy:
|
|
matrix:
|
|
arch: [arm64, armhf, amd64]
|
|
type: [neuron-sdk]
|
|
package: [tar.gz]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: release_url
|
|
|
|
- id: release_url
|
|
run: |
|
|
value=`cat release_url.txt`
|
|
echo "name=$value" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.type }}-${{ matrix.arch }}
|
|
|
|
- id: package
|
|
run: echo "name=${{ matrix.type }}-${{ env.VERSION }}-${{ matrix.arch }}.${{ matrix.package }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: upload daily release asset
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.release_url.outputs.name }}
|
|
asset_path: ./${{ steps.package.outputs.name }}
|
|
asset_name: ${{ matrix.type }}-${{ env.VERSION }}-daily-linux-${{ matrix.arch }}.${{ matrix.package }}
|
|
asset_content_type: application/octet-stream
|
|
|
|
upload_daily_release_debug_asset:
|
|
runs-on: ubuntu-20.04
|
|
if: github.event_name == 'push'
|
|
needs: create_daily_release
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64]
|
|
type: [neuron-sdk-debug]
|
|
package: [tar.gz]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: release_url
|
|
|
|
- id: release_url
|
|
run: |
|
|
value=`cat release_url.txt`
|
|
echo "name=$value" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.type }}-${{ matrix.arch }}
|
|
|
|
- id: package
|
|
run: echo "name=${{ matrix.type }}-${{ env.VERSION }}-${{ matrix.arch }}.${{ matrix.package }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: upload daily release asset
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.release_url.outputs.name }}
|
|
asset_path: ./${{ steps.package.outputs.name }}
|
|
asset_name: ${{ matrix.type }}-${{ env.VERSION }}-daily-linux-${{ matrix.arch }}.${{ matrix.package }}
|
|
asset_content_type: application/octet-stream
|
|
|
|
clean:
|
|
runs-on: ubuntu-20.04
|
|
needs: [upload_daily_release_asset, upload_daily_release_debug_asset]
|
|
steps:
|
|
- uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: release_url
|
|
|
|
release:
|
|
runs-on: ubuntu-20.04
|
|
if: github.event_name == 'release'
|
|
needs: cross-build
|
|
strategy:
|
|
matrix:
|
|
arch: [arm64, armhf, amd64]
|
|
type: [neuron-sdk]
|
|
package: [tar.gz]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.type }}-${{ matrix.arch }}
|
|
|
|
- id: package
|
|
run: echo "name=${{ matrix.type }}-${{ env.VERSION }}-${{ matrix.arch }}.${{ matrix.package }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: gen packages sha256
|
|
run: sudo bash -c "echo $(sha256sum ./${{ steps.package.outputs.name }} | awk '{print $1}') > ./${{ steps.package.outputs.name }}.sha256"
|
|
|
|
- uses: actions/upload-release-asset@v1
|
|
if: github.event_name == 'release'
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ./${{ steps.package.outputs.name}}.sha256
|
|
asset_name: ${{ matrix.type }}-${{ env.VERSION }}-linux-${{ matrix.arch }}.${{ matrix.package }}.sha256
|
|
asset_content_type: application/octet-stream
|
|
|
|
- uses: actions/upload-release-asset@v1
|
|
if: github.event_name == 'release'
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ./${{ steps.package.outputs.name}}
|
|
asset_name: ${{ matrix.type }}-${{ env.VERSION }}-linux-${{ matrix.arch }}.${{ matrix.package }}
|
|
asset_content_type: application/octet-stream
|