Skip to content

Commit

Permalink
Merge pull request #31 from AregevDev/buildsystem_rework
Browse files Browse the repository at this point in the history
Buildsystem Rework
  • Loading branch information
Jhonny Vargas authored Jan 29, 2023
2 parents 175081c + b208ce5 commit 13d37a6
Show file tree
Hide file tree
Showing 15 changed files with 435 additions and 703 deletions.
159 changes: 77 additions & 82 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,104 @@
name: Build Release
name: Release

on:
push:
tags:
- v*
- 'v*'

env:
CARGO_TERM_COLOR: always

jobs:
create-release:
runs-on: ubuntu-20.04
steps:
- name: Create Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitBody: true
prerelease: true
draft: true
token: ${{ secrets.ACCESS_TOKEN }}
build:
name: Build
runs-on: ${{ matrix.target.os }}
needs: create-release
strategy:
fail-fast: false
matrix:
target:
- os: ubuntu-20.04
- os: ubuntu-latest
triple: x86_64-unknown-linux-gnu
- os: macos-11
- os: macos-latest
triple: x86_64-apple-darwin
- os: macos-11
triple: aarch64-apple-darwin
- os: windows-2019
- os: windows-latest
triple: x86_64-pc-windows-msvc
features: ['static-link', 'static-link,nozlib']
features: [ 'build-assimp', 'static-link' ]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install dependencies (Linux)

# LLVM comes preinstalled on Windows and macOS runners.
- name: Install LLVM
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Install LLVM (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
if: runner.os == 'Windows'
with:
version: '11.0'
directory: ${{ runner.temp }}/llvm
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
cached: true
version: '14.0'

# CMake and Rust are preinstalled on all runners.

- name: Update Rust
run: |
brew install ninja
- name: Install Rust target ${{ matrix.target.triple }}
run: |
rustup target add ${{ matrix.target.triple }}
- name: Build ${{ matrix.target.triple }}
rustup default stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --target ${{ matrix.target.triple }} --features ${{ matrix.features }}

- name: Package Assimp
run: cargo run --bin package --target ${{ matrix.target.triple }} --bin package --features ${{ matrix.features }}
env:
RUSSIMP_BUILD_CACHE_DIR: ${{ runner.temp }}/release
RUSSIMP_BUILD_OUT_DIR: ${{ runner.temp }}/out
RUSSIMP_PREBUILT: OFF
run: |
cargo build -vv --release --no-default-features --features ${{ matrix.features }} --target ${{ matrix.target.triple }}
shell: bash
- name: Upload release
uses: ncipollo/release-action@v1
RUSSIMP_PACKAGE_DIR: ./russimp-package

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
allowUpdates: true
artifacts: ${{ runner.temp }}/release/*
artifactContentType: application/gzip
artifactErrorsFailBuild: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
prerelease: true
draft: true
token: ${{ secrets.ACCESS_TOKEN }}
publish-release:
runs-on: ubuntu-20.04
name: russimp-packages
path: ${{ env.RUSSIMP_PACKAGE_DIR }}/*
env:
RUSSIMP_PACKAGE_DIR: ./russimp-package

publish:
name: Publish Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Publish Release
uses: ncipollo/release-action@v1
- name: Checkout
uses: actions/checkout@v3
with:
allowUpdates: true
omitBody: true
token: ${{ secrets.ACCESS_TOKEN }}
cargo-publish:
needs: publish-release
env:
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install assimp
run: sudo bash ${GITHUB_WORKSPACE}/install_assimp.bash
- name: Install stable
uses: actions-rs/toolchain@v1
submodules: true

- name: Download artifacts
uses: actions/download-artifact@v3
with:
profile: minimal
toolchain: stable
override: true
- name: cargo publish
continue-on-error: true
run: cargo publish --token ${CRATESIO_TOKEN}
name: russimp-packages
path: ${{ runner.temp }}/russimp-package

- name: List artifacts
run: |
echo "Received artifacts:"
ls -l $RUSSIMP_PACKAGE_DIR
env:
RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package

- name: Publish release on GitHub
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
body: |
This release was automatically created by GitHub Actions.
files: |
${{ env.RUSSIMP_PACKAGE_DIR }}/*
token: ${{ secrets.ACCESS_TOKEN }}
env:
RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package

- name: Publish release on crates.io
run: cargo publish --features prebuilt --token $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package
96 changes: 45 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
name: Test

on: [push, pull_request]
on:
push:
branches:
- '**'
tags:
- '!v*' # Exclude tags starting with 'v'
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
lin-build:
runs-on: ubuntu-latest
test:
name: Test
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
target:
- os: ubuntu-latest
triple: x86_64-unknown-linux-gnu
- os: macos-latest
triple: x86_64-apple-darwin
- os: windows-latest
triple: x86_64-pc-windows-msvc
features: [ 'build-assimp', 'static-link' ]
steps:
- uses: actions/checkout@v2
- name: Install assimp
run: sudo bash ${GITHUB_WORKSPACE}/install_assimp.bash
- name: Install stable
uses: actions-rs/toolchain@v1
- name: Checkout
uses: actions/checkout@v3
with:
profile: minimal
toolchain: stable
override: true
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --lib --verbose
submodules: true

win-build:
runs-on: windows-latest
steps:
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Set up LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$env:VCINSTALLDIR\Tools\Llvm\x64\bin" >> $env:GITHUB_ENV
- uses: actions/checkout@v2
- name: Install stable
uses: actions-rs/toolchain@v1
# LLVM comes preinstalled on Windows and macOS runners
- name: Install LLVM
if: runner.os == 'Linux'
uses: KyleMayes/install-llvm-action@v1
with:
profile: minimal
toolchain: stable
override: true
- name: install cargo-vcpkg
run: cargo install cargo-vcpkg
- name: vcpkg build
run: cargo vcpkg build
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --lib --verbose
directory: ${{ runner.temp }}/llvm
cached: true
version: '14.0'

# CMake and Rust are preinstalled on all runners.

- name: Update Rust
run: |
rustup update stable
rustup target add ${{ matrix.target.triple }}
- name: Cache Rust
uses: Swatinem/rust-cache@v2

macos-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install assimp
run: brew install assimp
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --lib --verbose
run: cargo build --target ${{ matrix.target.triple }} --features ${{ matrix.features }}

- name: Test
run: cargo test --target ${{ matrix.target.triple }} --features ${{ matrix.features }}
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "assimp"]
path = assimp
url = https://github.com/assimp/assimp
branch = "master"
45 changes: 22 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
[package]
name = "russimp-sys"
version = "1.0.3"
version = "2.0.0"
authors = ["Jhonny Knaak de Vargas"]
edition = "2018"
edition = "2021"
license-file = "LICENSE"
readme = "README.md"
homepage = "https://github.com/jkvargas/russimp-sys"
categories = ["rendering", "external-ffi-bindings", "game-engines", "multimedia"]
keywords = ["assimp", "3d", "blend", "3ds", "glTF"]
repository = "https://github.com/jkvargas/russimp-sys"
description = "Raw Assimp bindings for rust"
description = "Raw Assimp bindings for Rust"
exclude = ["/assimp", "*.bash", "*.ps1"]

[lib]
name = "russimp_sys"
path = "src/lib.rs"
doctest = false

[[bin]]
name = "package"
path = "bin/package/main.rs"

[features]
default = []
prebuilt = ["static-link"]
static-link = []
nozlib = []
nolibcxx = []

[build-dependencies]
bindgen = "0.59.2"
vcpkg = "0.2.15"
ureq = "2.5"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tar = "0.4"
flate2 = "1.0"
num_cpus = "1.13"
build-assimp = []
prebuilt = []
static-link = ["build-assimp"]

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "7178ff9"
[dependencies]
flate2 = "1.0.25"
tar = "0.4.38"

[package.metadata.vcpkg.target]
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md", install = ["assimp", "zlib"] }
x86-pc-windows-msvc = { triplet = "x86-windows-static-md", install = ["assimp", "zlib"] }
[build-dependencies]
bindgen = "0.63.0"
built = "0.5.2"
cmake = "0.1.49"
flate2 = "1.0.25"
reqwest = { version = "0.11.13", features = ["blocking", "rustls-tls"] }
tar = "0.4.38"
which = "4.3.0"
Loading

0 comments on commit 13d37a6

Please sign in to comment.