mirror of
https://github.com/emqx/neuron.git
synced 2026-10-18 13:41:22 +08:00
279 lines
8.7 KiB
YAML
279 lines
8.7 KiB
YAML
name: compile
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
jobs:
|
|
cross-build:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- [aarch64-linux-gnu, aarch64, gcc-aarch64-linux-gnu, g++-aarch64-linux-gnu, /opt/externs/libs, arm64]
|
|
- [arm-linux-gnueabihf, armv4, gcc-arm-linux-gnueabihf, g++-arm-linux-gnueabihf, /opt/externs/libs, armhf]
|
|
- [x86_64-linux-gnu, x86_64, gcc, g++, /usr/local, amd64]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: install
|
|
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.arch[2] }} ${{ matrix.arch[3] }} pkg-config alien
|
|
|
|
- name: install dep
|
|
run: |
|
|
./install.sh -d ${{ matrix.arch[4] }} -c ${{ matrix.arch[0] }} -a ${{ matrix.arch[1] }}
|
|
|
|
- name: get version
|
|
id: get_version
|
|
run: echo "::set-output name=version::$(cat version)"
|
|
|
|
- name: compile
|
|
run: |
|
|
mkdir -p build && cd build
|
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/${{ matrix.arch[0] }}.cmake \
|
|
-DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON
|
|
make -j4
|
|
|
|
- name: Create neuron sdk package
|
|
run: |
|
|
./package-sdk.sh -p ${{ matrix.arch[5] }} -n neuron-sdk-${{ steps.get_version.outputs.version }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: neuron-sdk-${{ matrix.arch[5] }}
|
|
path: |
|
|
neuron-sdk-*.tar.gz
|
|
|
|
build-debug-sdk:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- [x86_64-linux-gnu, x86_64, gcc, g++, /usr/local, amd64]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: install
|
|
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.arch[2] }} ${{ matrix.arch[3] }} pkg-config alien
|
|
|
|
- name: install dep
|
|
run: |
|
|
./install.sh -d ${{ matrix.arch[4] }} -c ${{ matrix.arch[0] }} -a ${{ matrix.arch[1] }}
|
|
|
|
- name: get version
|
|
id: get_version
|
|
run: echo "::set-output name=version::$(cat version)"
|
|
|
|
- name: compile
|
|
run: |
|
|
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[5] }} -n neuron-sdk-debug-${{ steps.get_version.outputs.version }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: neuron-sdk-debug-${{ matrix.arch[5] }}
|
|
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: Extract branch name
|
|
shell: bash
|
|
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
id: extract_branch
|
|
|
|
- name: delete old daily-pre-release
|
|
uses: dev-drprasad/delete-tag-and-release@v0.2.0
|
|
with:
|
|
delete_release: true
|
|
tag_name: ${{ steps.extract_branch.outputs.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: ${{ steps.extract_branch.outputs.branch }}-daily
|
|
release_name: Daily Release(${{ steps.extract_branch.outputs.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@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: get version
|
|
id: get_version
|
|
run: echo "::set-output name=version::$(cat version)"
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: release_url
|
|
|
|
- id: release_url
|
|
run: |
|
|
value=`cat release_url.txt`
|
|
echo "::set-output name=name::$value"
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.type }}-${{ matrix.arch }}
|
|
|
|
- id: package
|
|
run: echo "::set-output name=name::${{ matrix.type }}-${{ steps.get_version.outputs.version }}-${{ matrix.arch }}.${{ matrix.package }}"
|
|
|
|
- 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 }}-${{ steps.get_version.outputs.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@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: get version
|
|
id: get_version
|
|
run: echo "::set-output name=version::$(cat version)"
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: release_url
|
|
|
|
- id: release_url
|
|
run: |
|
|
value=`cat release_url.txt`
|
|
echo "::set-output name=name::$value"
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.type }}-${{ matrix.arch }}
|
|
|
|
- id: package
|
|
run: echo "::set-output name=name::${{ matrix.type }}-${{ steps.get_version.outputs.version }}-${{ matrix.arch }}.${{ matrix.package }}"
|
|
|
|
- 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 }}-${{ steps.get_version.outputs.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@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: get version
|
|
id: get_version
|
|
run: echo "::set-output name=version::$(cat version)"
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.type }}-${{ matrix.arch }}
|
|
|
|
- id: package
|
|
run: echo "::set-output name=name::${{ matrix.type }}-${{ steps.get_version.outputs.version }}-${{ matrix.arch }}.${{ matrix.package }}"
|
|
|
|
- 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 }}-${{ steps.get_version.outputs.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 }}-${{ steps.get_version.outputs.version }}-linux-${{ matrix.arch }}.${{ matrix.package }}
|
|
asset_content_type: application/octet-stream |