Skip to content

Commit

Permalink
Introduce Rust (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderVocke authored Nov 15, 2024
1 parent 1c07fd2 commit 7330f78
Show file tree
Hide file tree
Showing 631 changed files with 13,127 additions and 3,858 deletions.
62 changes: 62 additions & 0 deletions .github/actions/build_and_upload_cmake_dependency/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Build a CMake project and upload it

inputs:
name:
description: "name of the dependency"
repo:
description: "repository URL"
git_rev:
description: "git revision to build"
configure_options:
description: "additional cmake configure options"
build_options:
description: "additional cmake build options"
targets_part:
description: "CMake targets"
default: "--target install"
upload_build_dir:
description: "Whether to upload the build directory instead of the installed one"
default: null
notify_installed:
description: "if set, this command is executed and given the path of the finished installation dir"
default: null

runs:
using: "composite"
steps:

- shell: wrap-shell {0}
run: |
git clone ${{ inputs.repo }} ${{ inputs.name }}
cd ${{ inputs.name }}
git checkout ${{ inputs.git_rev }}
mkdir ${{ inputs.name }}
mkdir build
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=$(pwd)/${{ inputs.name }} ${{ inputs.configure_options }}
cmake --build build/ ${{ inputs.build_options }} ${{ inputs.targets_part }}
- if: ${{ inputs.upload_build_dir }}
shell: wrap-shell {0}
run: |
rmdir ${{ inputs.name }}/${{ inputs.name }}
mv ${{ inputs.name }}/build ${{ inputs.name }}/${{ inputs.name }}
- name: Make relocatable (MacOS)
if: runner.os == 'macOS'
uses: ./.github/actions/macos_make_relocatable
with:
path: ${{ github.workspace }}/${{ inputs.name }}/${{ inputs.name }}
find_cmd: "find . -name \"*.dylib\""
match: ${{ github.workspace }}

- name: Notify
if: ${{ inputs.notify_installed }}
shell: wrap-shell {0}
run: ${{ inputs.notify_installed }} ${{ inputs.name }}/${{ inputs.name }}

- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}
path: ${{ github.workspace }}/${{ inputs.name }}/${{ inputs.name }}

50 changes: 50 additions & 0 deletions .github/actions/build_and_upload_meson_dependency/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Build a meson project and upload it

inputs:
name:
description: "name of the dependency"
repo:
description: "repository URL"
git_rev:
description: "git revision to build"
meson_options:
description: "additional meson configure options"
notify_installed:
description: "if set, this command is executed and given the path of the finished installation dir"
default: null

runs:
using: "composite"
steps:

- shell: wrap-shell {0}
run: |
git clone ${{ inputs.repo }} ${{ inputs.name }}
cd ${{ inputs.name }}
git checkout ${{ inputs.git_rev }}
mkdir ${{ inputs.name }}
mkdir build
${{ env.MESON }} setup ${{ inputs.meson_options }} --prefix=$(pwd)/${{ inputs.name }} --pkgconfig.relocatable build .
cd build
${{ env.MESON }} compile
${{ env.MESON }} install
- name: Make relocatable (MacOS)
if: runner.os == 'macOS'
uses: ./.github/actions/macos_make_relocatable
with:
path: ${{ github.workspace }}/${{ inputs.name }}/${{ inputs.name }}
find_cmd: "find . -name \"*.dylib\""
match: ${{ github.workspace }}

- name: Notify
if: ${{ inputs.notify_installed }}
shell: wrap-shell {0}
run: ${{ inputs.notify_installed }} $(pwd)/${{ inputs.name }}/${{ inputs.name }}

- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}
path: ${{ github.workspace }}/${{ inputs.name }}/${{ inputs.name }}

31 changes: 31 additions & 0 deletions .github/actions/build_base/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build Base
description: Do a basic Cargo build in the checked out repository

runs:
using: "composite"
steps:

- name: Rust cache
uses: Swatinem/rust-cache@v2
if: runner.os != 'Windows'
with:
prefix-key: v2
env-vars: "CARGO CC CFLAGS CXX CMAKE RUST PYO3"

- name: Build dependencies
if: always()
shell: wrap-shell {0}
run: |
cargo build --features "shoopdaloop/prebuild packaging/prebuild" ${CARGO_BUILD_FLAGS}
- name: Build main packages
if: always()
shell: wrap-shell {0}
run: |
cargo build -vv ${CARGO_BUILD_FLAGS}
- name: Build test code
if: always()
shell: wrap-shell {0}
run: |
cargo test -vv --no-run ${CARGO_BUILD_FLAGS}
Loading

0 comments on commit 7330f78

Please sign in to comment.