π fix release workflow #22
Workflow file for this run
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
name: Release Workflow | |
on: | |
# release: | |
# types: [created] | |
pull_request: | |
branches: | |
- main | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
NuGetDirectory: ${{ github.workspace }}/nuget | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
embedded-builds: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.continue-on-error }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
libpath: | | |
**/release/surreal_memory.dll | |
**/release/surreal_memory.pdb | |
**/release/surreal_rocksdb.dll | |
**/release/surreal_rocksdb.pdb | |
**/release/surreal_surrealkv.dll | |
**/release/surreal_surrealkv.pdb | |
continue-on-error: false | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
libpath: | | |
**/release/libsurreal_memory.so | |
**/release/libsurreal_rocksdb.so | |
**/release/libsurreal_surrealkv.so | |
continue-on-error: false | |
# π‘ not supported by the toolchain | |
# - os: ubuntu-latest | |
# target: x86_64-unknown-linux-musl | |
# libpath: | | |
# **/release/libsurreal_memory.so | |
# **/release/libsurreal_rocksdb.so | |
# **/release/libsurreal_surrealkv.so | |
# π‘ not supported by the toolchain | |
# - os: ubuntu-latest | |
# target: aarch64-unknown-linux-musl | |
# libpath: | | |
# **/release/libsurreal_memory.so | |
# **/release/libsurreal_rocksdb.so | |
# **/release/libsurreal_surrealkv.so | |
- os: ubuntu-latest | |
target: arm-unknown-linux-gnueabihf | |
libpath: | | |
**/release/libsurreal_memory.so | |
**/release/libsurreal_rocksdb.so | |
**/release/libsurreal_surrealkv.so | |
continue-on-error: true | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
libpath: | | |
**/release/libsurreal_memory.so | |
**/release/libsurreal_rocksdb.so | |
**/release/libsurreal_surrealkv.so | |
continue-on-error: true | |
- os: ubuntu-latest | |
target: aarch64-linux-android | |
libpath: | | |
**/release/libsurreal_memory.so | |
**/release/libsurreal_rocksdb.so | |
**/release/libsurreal_surrealkv.so | |
continue-on-error: false | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
libpath: | | |
**/release/libsurreal_memory.dylib | |
**/release/libsurreal_rocksdb.dylib | |
**/release/libsurreal_surrealkv.dylib | |
continue-on-error: false | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
libpath: | | |
**/release/libsurreal_memory.dylib | |
**/release/libsurreal_rocksdb.dylib | |
**/release/libsurreal_surrealkv.dylib | |
continue-on-error: false | |
- os: macos-latest | |
target: aarch64-apple-ios | |
libpath: | | |
**/release/libsurreal_memory.dylib | |
**/release/libsurreal_rocksdb.dylib | |
**/release/libsurreal_surrealkv.dylib | |
continue-on-error: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
sparse-checkout: | | |
rust-embedded | |
- name: Install gcc-aarch64-linux-gnu | |
run: sudo apt-get install gcc-aarch64-linux-gnu | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
- name: Setup Android NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r26d | |
if: matrix.target == 'aarch64-linux-android' | |
- name: Set Android linker for Rust target | |
run: echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/" >> $GITHUB_PATH | |
shell: bash | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
if: matrix.target == 'aarch64-linux-android' | |
- name: Install arm-linux-gnueabihf-gcc | |
run: sudo apt-get install arm-linux-gnueabihf-gcc | |
if: matrix.target == 'arm-unknown-linux-gnueabihf' | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.81.0 # must match the version in the `rust-embedded/rust-toolchain` file | |
target: ${{ matrix.target }} | |
- name: Cache Rust dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Build "memory" library | |
working-directory: ./rust-embedded/memory | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Build "rocksdb" library | |
working-directory: ./rust-embedded/rocksdb | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Build "surrealkv" library | |
working-directory: ./rust-embedded/surrealkv | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Publish embedded artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: embedded-${{ matrix.target }} | |
path: ${{ matrix.libpath }} | |
create-package: | |
needs: [embedded-builds] | |
runs-on: ubuntu-latest-4-cores | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download embedded artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: embedded-* | |
merge-multiple: true | |
- name: Setup dotnet 9.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "9.0.x" | |
- name: Create Package | |
run: dotnet pack /p:GenerateCompatibilitySuppressionFile=true --configuration Release --output ${{ env.NuGetDirectory }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: nuget | |
if-no-files-found: error | |
retention-days: 7 | |
path: ${{ env.NuGetDirectory }}/*.nupkg | |
validate-package: | |
needs: [create-package] | |
runs-on: ubuntu-latest-4-cores | |
steps: | |
- name: Setup dotnet 9.0 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "9.0.x" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: nuget | |
path: ${{ env.NuGetDirectory }} | |
- name: Install NuGet Package Validation Tool | |
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global | |
- name: Validate package | |
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg") | |
# publish-package: | |
# needs: [validate-package] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Setup dotnet 9.0 | |
# uses: actions/setup-dotnet@v3 | |
# with: | |
# dotnet-version: "9.0.x" | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: nuget | |
# path: ${{ env.NuGetDirectory }} | |
# - name: Publish NuGet package | |
# run: | | |
# foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { | |
# dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
# } |