Skip to content

Commit

Permalink
freetier build
Browse files Browse the repository at this point in the history
  • Loading branch information
rookiepeng committed Apr 7, 2024
1 parent aab47c3 commit 73e0908
Show file tree
Hide file tree
Showing 14 changed files with 608 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/release_linux_freetier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Release on Linux

on:
push:
tags:
- "*"

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
c_compiler: [gcc-12]
cxx_compiler: [g++-12]

steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.RADARSIMC }}
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build
env:
CC: ${{ matrix.c_compiler }}
CXX: ${{ matrix.cxx_compiler }}
run: |
sudo chown -R $USER:$USER /home/runner/work/radarsimpy
chmod +x build_linux_freetier.sh
./build_linux_freetier.sh
- name: Archive built module
uses: actions/upload-artifact@v4
if: success()
with:
name: radarsimpy_linux_py${{ matrix.python-version }}_freetier
path: ./radarsimpy
45 changes: 45 additions & 0 deletions .github/workflows/release_macos_freetier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Release on MacOS

on:
push:
tags:
- "*"

jobs:
build:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
c_compiler: [gcc-12]
cxx_compiler: [g++-12]

steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.RADARSIMC }}
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build
env:
CC: ${{ matrix.c_compiler }}
CXX: ${{ matrix.cxx_compiler }}
run: |
chmod +x build_macos_freetier.sh
./build_macos_freetier.sh
- name: Archive built module
uses: actions/upload-artifact@v4
if: success()
with:
name: radarsimpy_macos_py${{ matrix.python-version }}_freetier
path: ./radarsimpy
42 changes: 42 additions & 0 deletions .github/workflows/release_windows_freetier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Release on Windows

on:
push:
tags:
- "*"

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Checkout private tools
uses: actions/checkout@v4
with:
repository: rookiepeng/radarsimcpp
ssh-key: ${{ secrets.RADARSIMC }}
path: src/radarsimcpp
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build
run: |
.\build_win_freetier.bat
- name: Archive built module
uses: actions/upload-artifact@v4
if: success()
with:
name: radarsimpy_win_py${{ matrix.python-version }}_freetier
path: .\radarsimpy
60 changes: 60 additions & 0 deletions build_linux_freetier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

echo "Automatic build script of radarsimcpp/radarsimpy for Linux"
echo ""
echo "----------"
echo "RadarSimPy - A Radar Simulator Built with Python"
echo "Copyright (C) 2018 - PRESENT radarsimx.com"
echo "E-mail: [email protected]"
echo "Website: https://radarsimx.com"
echo ""
echo "██████╗ █████╗ ██████╗ █████╗ ██████╗ ███████╗██╗███╗ ███╗██╗ ██╗"
echo "██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝"
echo "██████╔╝███████║██║ ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ "
echo "██╔══██╗██╔══██║██║ ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ "
echo "██║ ██║██║ ██║██████╔╝██║ ██║██║ ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗"
echo "╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"

workpath=$(pwd)

echo "## Clean old build files ##"
rm -rf ./src/radarsimcpp/build
rm -rf ./radarsimpy

echo "## Building libradarsimcpp.so with CPU ##"
mkdir ./src/radarsimcpp/build
cd ./src/radarsimcpp/build

cmake -DCMAKE_BUILD_TYPE=Release -DGTEST=ON ..
cmake --build .

echo "## Building radarsimpy with Cython ##"
cd $workpath
python setup_freetier.py build_ext -b ./

echo "## Copying lib files to ./radarsimpy ##"
# mkdir ./radarsimpy/lib
cp ./src/radarsimpy/*.py ./radarsimpy
cp ./src/radarsimpy/lib/__init__.py ./radarsimpy/lib
cp ./src/radarsimcpp/build/*.so ./radarsimpy

echo "## Cleaning radarsimpy builds ##"
rm -rf build

rm -f ./src/radarsimpy/*.c
rm -f ./src/radarsimpy/*.cpp
rm -f ./src/radarsimpy/*.html
rm -f ./src/radarsimpy/raytracing/*.c
rm -f ./src/radarsimpy/raytracing/*.cpp
rm -f ./src/radarsimpy/raytracing/*.html
rm -f ./src/radarsimpy/lib/*.cpp
rm -f ./src/radarsimpy/lib/*.html
rm -f ./src/*.cpp
rm -f ./src/*.html

echo "## Copying lib files to unit test folder ##"
rm -rf ./tests/radarsimpy
mkdir ./tests/radarsimpy
cp -rf ./radarsimpy/* ./tests/radarsimpy

echo "## Build completed ##"
60 changes: 60 additions & 0 deletions build_macos_freetier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

echo "Automatic build script of radarsimcpp/radarsimpy for macOS"
echo ""
echo "----------"
echo "RadarSimPy - A Radar Simulator Built with Python"
echo "Copyright (C) 2018 - PRESENT radarsimx.com"
echo "E-mail: [email protected]"
echo "Website: https://radarsimx.com"
echo ""
echo "██████╗ █████╗ ██████╗ █████╗ ██████╗ ███████╗██╗███╗ ███╗██╗ ██╗"
echo "██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝"
echo "██████╔╝███████║██║ ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ "
echo "██╔══██╗██╔══██║██║ ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ "
echo "██║ ██║██║ ██║██████╔╝██║ ██║██║ ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗"
echo "╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"

workpath=$(pwd)

echo "## Clean old build files ##"
rm -rf ./src/radarsimcpp/build
rm -rf ./radarsimpy

echo "## Building libradarsimcpp.so with CPU ##"
mkdir ./src/radarsimcpp/build
cd ./src/radarsimcpp/build

cmake -DCMAKE_BUILD_TYPE=Release -DGTEST=ON ..
cmake --build .

echo "## Building radarsimpy with Cython ##"
cd $workpath
python setup_freetier.py build_ext -b ./

echo "## Copying lib files to ./radarsimpy ##"
# mkdir ./radarsimpy/lib
cp ./src/radarsimpy/*.py ./radarsimpy
cp ./src/radarsimpy/lib/__init__.py ./radarsimpy/lib
cp ./src/radarsimcpp/build/*.dylib ./radarsimpy

echo "## Cleaning radarsimpy builds ##"
rm -rf build

rm -f ./src/radarsimpy/*.c
rm -f ./src/radarsimpy/*.cpp
rm -f ./src/radarsimpy/*.html
rm -f ./src/radarsimpy/raytracing/*.c
rm -f ./src/radarsimpy/raytracing/*.cpp
rm -f ./src/radarsimpy/raytracing/*.html
rm -f ./src/radarsimpy/lib/*.cpp
rm -f ./src/radarsimpy/lib/*.html
rm -f ./src/*.cpp
rm -f ./src/*.html

echo "## Copying lib files to unit test folder ##"
rm -rf ./tests/radarsimpy
mkdir ./tests/radarsimpy
cp -rf ./radarsimpy/* ./tests/radarsimpy

echo "## Build completed ##"
72 changes: 72 additions & 0 deletions build_win_freetier.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@ECHO OFF

ECHO Automatic build script of radarsimcpp/radarsimpy for Windows
ECHO:
ECHO ----------
ECHO RadarSimPy - A Radar Simulator Built with Python
ECHO Copyright (C) 2018 - PRESENT radarsimx.com
ECHO E-mail: [email protected]
ECHO Website: https://radarsimx.com
ECHO:
ECHO ******* ** ******** ** ** **
ECHO /**////** /** **////// // //** **
ECHO /** /** ****** /** ****** ******/** ** ********** //** **
ECHO /******* //////** ****** //////** //**//*/*********/**//**//**//** //***
ECHO /**///** ******* **///** ******* /** / ////////**/** /** /** /** **/**
ECHO /** //** **////** /** /** **////** /** /**/** /** /** /** ** //**
ECHO /** //**//********//******//********/*** ******** /** *** /** /** ** //**
ECHO // // //////// ////// //////// /// //////// // /// // // // //
ECHO:

SET pwd=%cd%

ECHO clean old build files
RMDIR /Q/S .\src\radarsimcpp\build

ECHO clean old radarsimpy module
RMDIR /Q/S .\radarsimpy

@REM go to the build folder
MD ".\src\radarsimcpp\build"
CD ".\src\radarsimcpp\build"

ECHO ## Building radarsimcpp.dll with MSVC ##
@REM MSVC needs to set the build type using '--config Relesae'
cmake -DGTEST=ON ..
cmake --build . --config Release

ECHO ## Building radarsimpy with Cython ##
CD %pwd%
python setup_freetier.py build_ext -b ./

ECHO ## Copying dll files to ./radarsimpy ##
XCOPY ".\src\radarsimcpp\build\Release\radarsimcpp.dll" ".\radarsimpy\"
XCOPY ".\src\radarsimpy\*.py" ".\radarsimpy\"
XCOPY ".\src\radarsimpy\lib\__init__.py" ".\radarsimpy\lib\"

ECHO ## Cleaning radarsimpy builds ##
RMDIR build /s /q

DEL ".\src\radarsimpy\*.c"
DEL ".\src\radarsimpy\*.cpp"
DEL ".\src\radarsimpy\*.html"
DEL ".\src\radarsimpy\raytracing\*.c"
DEL ".\src\radarsimpy\raytracing\*.cpp"
DEL ".\src\radarsimpy\raytracing\*.html"
DEL ".\src\radarsimpy\lib\*.cpp"
DEL ".\src\radarsimpy\lib\*.html"
DEL ".\src\*.cpp"
DEL ".\src\*.html"

ECHO ## Copying lib files to unit test folder ##

RMDIR /Q/S .\tests\radarsimpy
XCOPY /E /I .\radarsimpy .\tests\radarsimpy

ECHO ## Build completed ##

@REM ECHO ## Run Google test ##
@REM .\src\radarsimcpp\build\Release\radarsimcpp_test.exe

@REM ECHO ## Pytest ##
@REM pytest
Loading

0 comments on commit 73e0908

Please sign in to comment.