FreeDATA/.github/workflows/build-project.yml
2021-09-02 21:24:51 +02:00

215 lines
6.4 KiB
YAML

name: Build/PROJECT
on:
push:
#tags:
#- '*'
jobs:
build_release:
name: Build release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
include:
- os: ubuntu-latest
zip_name: ubuntu_tnc
generator: Unix Makefiles
#- os: macos-latest
# zip_name: plugin-mac
# generator: Xcode
#- os: windows-latest
# zip_name: plugin-win
# generator: Visual Studio 16 2019
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install portaudio19-dev libhamlib-dev libhamlib-utils build-essential cmake python3-libhamlib2
python -m pip install --upgrade pip
pip3 install pyaudio
pip3 install psutil
pip3 install crcengine
pip3 install pyinstaller
pip3 install ujson
#- name: Build Hamlib Python Binding
# if: matrix.os == 'ubuntu-latest'
# working-directory: tnc
# run: |
# sudo apt install wig libtool
# cd ~
# git clone https://github.com/Hamlib/Hamlib.git
# cd Hamlib
# ./bootstrap
# ./configure --with-python-binding PYTHON_VERSION='3.9' --prefix=$HOME/local
# make
# make install
- name: Build Linux
if: matrix.os == 'ubuntu-latest'
working-directory: tnc
run: |
pyinstaller -F daemon.py -n daemon
pyinstaller -F main.py -n tnc
- name: Build codec2 Linux
if: matrix.os == 'ubuntu-latest'
# working-directory: tnc
run: |
cd ~
git clone https://github.com/drowe67/codec2.git
cd codec2 && mkdir build_linux && cd build_linux
cmake ../
make
- name: Build LPCNet Linux
if: matrix.os == 'ubuntu-latest'
# working-directory: tnc
run: |
cd ~
git clone https://github.com/drowe67/LPCNet
cd LPCNet && mkdir build_linux && cd build_linux
cmake -DCODEC2_BUILD_DIR=~/codec2/build_linux ../
make
- name: ReBuild codec2 with LPCNet Linux
if: matrix.os == 'ubuntu-latest'
# working-directory: tnc
run: |
cd ~/codec2/build_linux && rm -Rf *
cmake -DLPCNET_BUILD_DIR=~/LPCNet/build_linux ..
make
- name: LIST ALL FILES
shell: bash
run: |
ls -R
- name: Copy hamlib to TNC Linux
if: matrix.os == 'ubuntu-latest'
working-directory: tnc
run: |
cp -R ./hamlib ./dist
- name: Copy codec2 to TNC Linux
if: matrix.os == 'ubuntu-latest'
# working-directory: tnc
run: |
cp -R ~/codec2 ./tnc/dist
ls -R
- name: Compress Linux
shell: bash
run: |
cd ./tnc/dist
mkdir compressed
zip -r ./compressed/${{ matrix.zip_name }}.zip *
- name: Upload Ubuntu TNC artifacts
uses: actions/upload-artifact@v2
with:
name: tnc-artifact
path: ./tnc/dist/compressed/*
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14
- name: Copy TNC to GUI Linux
if: matrix.os == 'ubuntu-latest'
# working-directory: tnc
run: |
cp -R ./tnc/dist ./gui/tnc
ls -R
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
package_root: "./gui/"
github_token: ${{ secrets.github_token }}
- name: LIST ALL FILES
shell: bash
run: |
ls -R
- name: chmod +x
shell: bash
run: |
chmod +x ./gui/dist/*.AppImage
- name: Create app bundle
shell: bash
run: |
mkdir gui-bundle
cp ./gui/dist/*.AppImage gui-bundle
cp -R ./tnc/dist/hamlib gui-bundle
cp -R ./tnc/dist/codec2 gui-bundle
cp ./tnc/dist/daemon gui-bundle
cp ./tnc/dist/tnc gui-bundle
cd ./gui-bundle
zip -r codec2-FreeDATA_linux.zip .
ls -R
- name: Upload Ubuntu GUI Bundle artifacts
uses: actions/upload-artifact@v2
with:
name: gui-bundle-ubuntu-artifact
#path: ./gui/dist/*.AppImage
#path: ./gui/dist/*
path: ./gui-bundle/codec2-FreeDATA_linux.zip
release:
name: Upload Release
needs: build_release
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
- name: LIST ALL FILES
shell: bash
run: |
ls -R
- name: Release
uses: WebFreak001/deploy-nightly@v1.1.0
#uses: softprops/action-gh-release@v1
#if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/DJ2LS/codec2-FreeDATA/releases/48616289/assets{?name,label} # find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases in your browser and copy the full "upload_url" value including the {?name,label} part
release_id: 48616289 # same as above (id can just be taken out the upload_url, it's used to find old releases)
asset_path: ./gui-bundle-ubuntu-artifact/codec2-FreeDATA_linux.zip # path to archive to upload
asset_name: codec2-FreeDATA_linux-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 7 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
#files: |
# ./gui-bundle-ubuntu-artifact/codec2-FreeDATA_ubuntu.zip
# ./tnc-artifact/ubuntu_tnc.zip
# LICENSE