redesigned release and build pipelines (#26)
parent
43d6420b2c
commit
556298890d
@ -1,47 +1,140 @@
|
||||
name: dvmhost-build
|
||||
# Author: K4YT3X <i@k4yt3x.com>
|
||||
|
||||
# Controls when the workflow will run
|
||||
name: dvmhost-build
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
#run on push/PR
|
||||
inputs:
|
||||
buildType:
|
||||
description: 'CMake Build Type'
|
||||
required: true
|
||||
default: 'Release'
|
||||
type: choice
|
||||
options:
|
||||
- Release
|
||||
- Debug
|
||||
- RelWithDebInfo
|
||||
- MinSizeRel
|
||||
stripSymbols:
|
||||
description: 'Strip Symbols'
|
||||
required: false
|
||||
type: boolean
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
setup:
|
||||
name: Setup
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
APPNAME: ${{ steps.get_appname.outputs.APPNAME }}
|
||||
DATE: ${{ steps.get_date.outputs.DATE }}
|
||||
steps:
|
||||
- name: Get app name
|
||||
id: get_appname
|
||||
run: echo APPNAME=${{ github.event.repository.name }} >> $GITHUB_OUTPUT
|
||||
- name: Get date
|
||||
id: get_date
|
||||
run: echo DATE=$(date +'%Y-%m-%d') >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
name: Build
|
||||
needs: [setup]
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["amd64", "arm", "aarch64", "armhf"]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.DATE }}-${{ matrix.arch }}
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
steps:
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v5.1
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
||||
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install -y git build-essential cmake \
|
||||
g++-arm-linux-gnueabihf \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
g++-aarch64-linux-gnu \
|
||||
libasio-dev
|
||||
- name: Build
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == 'push' ]]; then
|
||||
build_args="-DCMAKE_BUILD_TYPE=${{ inputs.buildType }}"
|
||||
if [[ "${{ inputs.stripSymbols }}" == 'true' ]]; then
|
||||
build_args="$build_args -DCMAKE_C_FLAGS='-s' -DCMAKE_CXX_FLAGS='-s'"
|
||||
fi
|
||||
else
|
||||
build_args='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-s" -DCMAKE_CXX_FLAGS="-s"'
|
||||
fi
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get install -y gcc-arm-none-eabi cmake build-essential devscripts debhelper libasio-dev
|
||||
if [[ "${{ matrix.arch }}" == 'armhf' ]]; then
|
||||
git clone https://github.com/chriskohlhoff/asio.git
|
||||
cmake $(echo $build_args) -DCROSS_COMPILE_RPI_ARM=1 -DWITH_ASIO='asio/asio' .
|
||||
else
|
||||
cmake $(echo $build_args) \
|
||||
-D "CROSS_COMPILE_$(echo '${{ matrix.arch }}' | tr '[:lower:]' '[:upper:]')=1" .
|
||||
fi
|
||||
|
||||
- name: Sync Git Submodules
|
||||
run: git submodule init && git submodule update
|
||||
make -j $(nproc)
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir -p ${{ env.PACKAGENAME }}
|
||||
cp dvmcmd dvmhost ${{ env.PACKAGENAME }}
|
||||
zip -9 -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ needs.setup.outputs.APPNAME }}-${{ matrix.arch }}
|
||||
path: ${{ env.PACKAGENAME }}.zip
|
||||
|
||||
- name: Change /opt Permissions
|
||||
run: sudo chmod 777 /opt
|
||||
|
||||
- name: Generate build files with CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
create-release:
|
||||
if: ${{ github.event == 'push' }}
|
||||
name: Create Release
|
||||
needs: [setup, build]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ needs.setup.outputs.DATE }}
|
||||
name: Nightly Build ${{ needs.setup.outputs.DATE }}
|
||||
draft: false
|
||||
prerelease: true
|
||||
|
||||
- name: Build binaries
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j $(nproc)
|
||||
upload:
|
||||
if: ${{ github.event == 'push' }}
|
||||
name: Upload
|
||||
needs: [setup, build, create-release]
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["amd64", "arm", "aarch64", "armhf"]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.DATE }}-${{ matrix.arch }}
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ${{ needs.setup.outputs.APPNAME }}-${{ matrix.arch }}
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||
asset_path: ${{ env.PACKAGENAME }}.zip
|
||||
asset_name: ${{ env.PACKAGENAME }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
name: dvmhost-build-dpkg
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v5.1
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
||||
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get install -y gcc-arm-none-eabi build-essential devscripts debhelper libasio-dev
|
||||
|
||||
- name: Sync Git Submodules
|
||||
run: git submodule init && git submodule update
|
||||
|
||||
- name: Generate build files with CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Build binaries
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j $(nproc)
|
||||
|
||||
- name: Change /opt Permissions
|
||||
run: sudo chmod 777 /opt
|
||||
|
||||
- name: Build Debian Package
|
||||
run: |
|
||||
cd ${{github.workspace}}/build
|
||||
cpack
|
||||
|
||||
- name: Package Hash
|
||||
run: |
|
||||
echo "BRANCH: ${{steps.branch-name.outputs.current_branch}}" >> release.txt
|
||||
echo "COMMIT: ${{github.sha}}" >> release.txt
|
||||
echo >> release.txt
|
||||
echo '```' >> release.txt
|
||||
cat << EOF >> release.txt
|
||||
dvmhost_3.0.0-1_amd64.deb
|
||||
size : $(wc -c dvmhost_3.0.0-1_amd64.deb)
|
||||
md5 : $(md5sum dvmhost_3.0.0-1_amd64.deb)
|
||||
sha1 : $(sha1sum dvmhost_3.0.0-1_amd64.deb)
|
||||
sha256: $(sha256sum dvmhost_3.0.0-1_amd64.deb)
|
||||
EOF
|
||||
echo '```' >> release.txt
|
||||
|
||||
- name: Release Artifacts
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{steps.date.outputs.date}}
|
||||
body_path: release.txt
|
||||
files: |
|
||||
dvmhost_3.0.0-1_amd64.deb
|
||||
@ -1,71 +0,0 @@
|
||||
name: dvmhost-build-prerelease
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
#run on push/PR
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v5.1
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
||||
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get install -y gcc-arm-none-eabi cmake build-essential devscripts debhelper libasio-dev
|
||||
|
||||
- name: Sync Git Submodules
|
||||
run: git submodule init && git submodule update
|
||||
|
||||
- name: Change /opt Permissions
|
||||
run: sudo chmod 777 /opt
|
||||
|
||||
- name: Generate build files with CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Build binaries
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j $(nproc)
|
||||
|
||||
- name: Package Hash
|
||||
run: |
|
||||
echo "BRANCH: ${{steps.branch-name.outputs.current_branch}}" >> release.txt
|
||||
echo "COMMIT: ${{github.sha}}" >> release.txt
|
||||
echo >> release.txt
|
||||
echo '```' >> release.txt
|
||||
cat << EOF >> release.txt
|
||||
dvmhost
|
||||
size : $(wc -c ${{github.workspace}}/build/dvmhost)
|
||||
md5 : $(md5sum ${{github.workspace}}/build/dvmhost)
|
||||
sha1 : $(sha1sum ${{github.workspace}}/build/dvmhost)
|
||||
sha256: $(sha256sum ${{github.workspace}}/build/dvmhost)
|
||||
EOF
|
||||
echo '```' >> release.txt
|
||||
|
||||
- name: Release Artifacts
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{steps.date.outputs.date}}
|
||||
body_path: release.txt
|
||||
prerelease: true
|
||||
files: |
|
||||
${{github.workspace}}/build/dvmhost
|
||||
Loading…
Reference in new issue