-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement github actions workflow for wrapper build
- Loading branch information
1 parent
739a31c
commit 54b900c
Showing
1 changed file
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
name: Multiplatform build of libuuu wrapper python package | ||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
build-dlls: | ||
name: Build of dynamically linked libraries | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
- name: Checkout uuu repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
submodules: false | ||
|
||
- name: Clone vcpkg repository | ||
run: | | ||
git clone https://github.com/microsoft/vcpkg.git | ||
- name: Set up vcpkg on Windows | ||
working-directory: ./vcpkg | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
echo ("VCPKG_ROOT=" + $PWD.Path) >> $env:GITHUB_ENV | ||
./bootstrap-vcpkg.bat | ||
- name: Set up vcpkg on Ubuntu and MacOS | ||
working-directory: ./vcpkg | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
echo "VCPKG_ROOT=$(pwd)" >> $GITHUB_ENV | ||
./bootstrap-vcpkg.sh | ||
- name: Install dependencies Ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get install gcc cmake ninja-build autotools-dev automake autoconf libudev-dev | ||
- name: Install dependencies MacOS | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
brew install ninja cmake autoconf automake libtool | ||
- name: Install dependencies Windows | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
choco install cmake pkgconfiglite | ||
- name: Build on Ubuntu and MacOS | ||
working-directory: ./wrapper | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
export PATH=$VCPKG_ROOT:$PATH | ||
cmake --preset=unix | ||
cmake --build build | ||
- name: Build on Windows | ||
working-directory: ./wrapper | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
$env:Path = $env:VCPKG_ROOT + ';' + $env:Path | ||
cmake --preset=windows | ||
cmake --build build | ||
- name: Upload artifacts Windows | ||
if: matrix.os == 'windows-latest' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libuuu-windows | ||
path: ./wrapper/build/Debug/*.dll | ||
|
||
- name: Upload artifacts MacOS | ||
if: matrix.os == 'macos-latest' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libuuu-macos | ||
path: ./wrapper/build/libuuu.dylib | ||
|
||
- name: Upload artifacts Ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libuuu-ubuntu | ||
path: ./wrapper/build/libuuu.so | ||
|
||
build-libuuu-wrapper: | ||
runs-on: ubuntu-latest | ||
needs: build-dlls | ||
steps: | ||
- name: Checkout uuu repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
submodules: false | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: libuuu-* | ||
merge-multiple: true | ||
path: ./wrapper/libuuu/lib/ | ||
|
||
- name: Check the path | ||
run: | | ||
find ./wrapper/ | ||
- name: Install python dependencies | ||
working-directory: ./wrapper | ||
run: | | ||
pip install --upgrade pip | ||
pip install --force-reinstall -U build twine nxp-codecheck colorama setuptools_scm | ||
- name: Build the python package | ||
working-directory: ./wrapper | ||
run: | | ||
python -m build --sdist --wheel | ||
- name: Run codecheck | ||
working-directory: ./wrapper | ||
run: | | ||
codecheck -s | ||
- name: Upload reports if codecheck fails | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: reports | ||
path: ./wrapper/reports/* | ||
|
||
- name: Release package to pypi | ||
if: github.ref_type == 'tag' | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
#TWINE_REPOSITORY_URL: ${{ secrets.TWINE_REPOSITORY_URL }} | ||
working-directory: ./wrapper | ||
run: | | ||
twine --no-color check dist/* | ||
twine --no-color upload --repository pypi dist/* | ||
- name: Upload the dist folder | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: ./wrapper/dist |