Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Fix Cargo package build script to allow vendoring and publishing #778

Fix Cargo package build script to allow vendoring and publishing

Fix Cargo package build script to allow vendoring and publishing #778

Workflow file for this run

name: Build
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build-cpp:
strategy:
fail-fast: false
matrix:
include:
- artifact-name: Native - Windows (CasADi)
cmake-config-env-vars:
cmake-flags: "-G \"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++"
optimizer: casadi
os: windows-2022
- artifact-name: Native - macOS x86_64 (CasADi)
cmake-config-env-vars: CFLAGS="$CFLAGS -arch x86_64" CXXFLAGS="$CXXFLAGS -arch x86_64"
cmake-flags: "-DCMAKE_APPLE_SILICON_PROCESSOR=x86_64"
optimizer: casadi
os: macOS-12
- artifact-name: Native - macOS arm64 (CasADi)
cmake-config-env-vars: CFLAGS="$CFLAGS -arch arm64" CXXFLAGS="$CXXFLAGS -arch arm64"
cmake-flags: "-DCMAKE_APPLE_SILICON_PROCESSOR=arm64"
optimizer: casadi
os: macOS-12
- artifact-name: Native - Linux (CasADi)
cmake-config-env-vars:
cmake-flags:
optimizer: casadi
os: ubuntu-latest
- artifact-name: Native - Windows (Sleipnir)
cmake-config-env-vars:
cmake-flags:
optimizer: sleipnir
os: windows-2022
- artifact-name: Native - macOS universal (Sleipnir)
cmake-config-env-vars: CFLAGS="$CFLAGS -arch x86_64 -arch arm64" CXXFLAGS="$CXXFLAGS -arch x86_64 -arch arm64"
cmake-flags:
optimizer: sleipnir
os: macOS-12
- artifact-name: Native - Linux (Sleipnir)
cmake-config-env-vars:
cmake-flags:
optimizer: sleipnir
os: ubuntu-latest
name: "${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up MinGW
if: matrix.os == 'windows-2022' && matrix.optimizer == 'casadi'
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
version: 12.2.0
- name: configure
run: ${{ matrix.cmake-config-env-vars }} cmake -B build -S . ${{ matrix.cmake-flags }} -DOPTIMIZER_BACKEND=${{ matrix.optimizer }} -DWITH_JAVA=ON -DJAVA_INSTALL_JAR=OFF
- name: build
run: cmake --build build --config RelWithDebInfo --parallel $(nproc)
- name: install
run: cmake --install build --config RelWithDebInfo --prefix pkg
- uses: actions/[email protected]
with:
name: ${{ matrix.artifact-name }}
path: pkg
- uses: actions/[email protected]
with:
name: ${{ matrix.artifact-name }}-java-libraries
path: java/src/main/resources
build-wasm:
name: "Wasm"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup emscripten
uses: numworks/setup-emscripten@latest
- name: configure
run: emcmake cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DOPTIMIZER_BACKEND=sleipnir
- name: build
run: cmake --build build --config Release --parallel $(nproc)
- name: install
run: cmake --install build --config Release --prefix pkg
- uses: actions/[email protected]
with:
name: Wasm
path: pkg
collect-java-native-libs:
strategy:
fail-fast: false
needs: build-cpp
name: Collect Java Native Libs
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: Native - Windows (CasADi)-java-libraries
path: java/src/main/resources
- uses: actions/download-artifact@v3
with:
name: Native - macOS x86_64 (CasADi)-java-libraries
path: java/src/main/resources
- uses: actions/download-artifact@v3
with:
name: Native - macOS arm64 (CasADi)-java-libraries
path: java/src/main/resources
- uses: actions/download-artifact@v3
with:
name: Native - Linux (CasADi)-java-libraries
path: java/src/main/resources
- run: cd java/src/main/resources/osx;ls
- uses: actions/[email protected]
with:
name: all-java-libraries
path: java/src/main/resources