Skip to content

Commit 13d37a6

Browse files
author
Jhonny Vargas
authored
Merge pull request #31 from AregevDev/buildsystem_rework
Buildsystem Rework
2 parents 175081c + b208ce5 commit 13d37a6

File tree

15 files changed

+435
-703
lines changed

15 files changed

+435
-703
lines changed

.github/workflows/release.yml

Lines changed: 77 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,104 @@
1-
name: Build Release
1+
name: Release
2+
23
on:
34
push:
45
tags:
5-
- v*
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
611
jobs:
7-
create-release:
8-
runs-on: ubuntu-20.04
9-
steps:
10-
- name: Create Release
11-
uses: ncipollo/release-action@v1
12-
with:
13-
allowUpdates: true
14-
omitBody: true
15-
prerelease: true
16-
draft: true
17-
token: ${{ secrets.ACCESS_TOKEN }}
1812
build:
13+
name: Build
1914
runs-on: ${{ matrix.target.os }}
20-
needs: create-release
2115
strategy:
22-
fail-fast: false
2316
matrix:
2417
target:
25-
- os: ubuntu-20.04
18+
- os: ubuntu-latest
2619
triple: x86_64-unknown-linux-gnu
27-
- os: macos-11
20+
- os: macos-latest
2821
triple: x86_64-apple-darwin
29-
- os: macos-11
30-
triple: aarch64-apple-darwin
31-
- os: windows-2019
22+
- os: windows-latest
3223
triple: x86_64-pc-windows-msvc
33-
features: ['static-link', 'static-link,nozlib']
24+
features: [ 'build-assimp', 'static-link' ]
3425
steps:
3526
- name: Checkout
36-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
3728
with:
3829
submodules: true
39-
- name: Install rust
40-
uses: actions-rs/toolchain@v1
41-
with:
42-
toolchain: stable
43-
override: true
44-
- name: Install dependencies (Linux)
30+
31+
# LLVM comes preinstalled on Windows and macOS runners.
32+
- name: Install LLVM
4533
if: runner.os == 'Linux'
46-
run: |
47-
sudo apt-get update
48-
sudo apt-get install ninja-build
49-
- name: Install LLVM (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
5034
uses: KyleMayes/install-llvm-action@v1
51-
if: runner.os == 'Windows'
5235
with:
53-
version: '11.0'
5436
directory: ${{ runner.temp }}/llvm
55-
- name: Install dependencies (macOS)
56-
if: runner.os == 'macOS'
37+
cached: true
38+
version: '14.0'
39+
40+
# CMake and Rust are preinstalled on all runners.
41+
42+
- name: Update Rust
5743
run: |
58-
brew install ninja
59-
- name: Install Rust target ${{ matrix.target.triple }}
60-
run: |
61-
rustup target add ${{ matrix.target.triple }}
62-
- name: Build ${{ matrix.target.triple }}
44+
rustup default stable
45+
46+
- name: Cache Rust
47+
uses: Swatinem/rust-cache@v2
48+
49+
- name: Build
50+
run: cargo build --target ${{ matrix.target.triple }} --features ${{ matrix.features }}
51+
52+
- name: Package Assimp
53+
run: cargo run --bin package --target ${{ matrix.target.triple }} --bin package --features ${{ matrix.features }}
6354
env:
64-
RUSSIMP_BUILD_CACHE_DIR: ${{ runner.temp }}/release
65-
RUSSIMP_BUILD_OUT_DIR: ${{ runner.temp }}/out
66-
RUSSIMP_PREBUILT: OFF
67-
run: |
68-
cargo build -vv --release --no-default-features --features ${{ matrix.features }} --target ${{ matrix.target.triple }}
69-
shell: bash
70-
- name: Upload release
71-
uses: ncipollo/release-action@v1
55+
RUSSIMP_PACKAGE_DIR: ./russimp-package
56+
57+
- name: Upload artifacts
58+
uses: actions/upload-artifact@v3
7259
with:
73-
allowUpdates: true
74-
artifacts: ${{ runner.temp }}/release/*
75-
artifactContentType: application/gzip
76-
artifactErrorsFailBuild: true
77-
omitBodyDuringUpdate: true
78-
omitNameDuringUpdate: true
79-
prerelease: true
80-
draft: true
81-
token: ${{ secrets.ACCESS_TOKEN }}
82-
publish-release:
83-
runs-on: ubuntu-20.04
60+
name: russimp-packages
61+
path: ${{ env.RUSSIMP_PACKAGE_DIR }}/*
62+
env:
63+
RUSSIMP_PACKAGE_DIR: ./russimp-package
64+
65+
publish:
66+
name: Publish Release
8467
needs: build
68+
runs-on: ubuntu-latest
8569
steps:
86-
- name: Publish Release
87-
uses: ncipollo/release-action@v1
70+
- name: Checkout
71+
uses: actions/checkout@v3
8872
with:
89-
allowUpdates: true
90-
omitBody: true
91-
token: ${{ secrets.ACCESS_TOKEN }}
92-
cargo-publish:
93-
needs: publish-release
94-
env:
95-
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
96-
runs-on: ubuntu-20.04
97-
steps:
98-
- uses: actions/checkout@v2
99-
- name: Install assimp
100-
run: sudo bash ${GITHUB_WORKSPACE}/install_assimp.bash
101-
- name: Install stable
102-
uses: actions-rs/toolchain@v1
73+
submodules: true
74+
75+
- name: Download artifacts
76+
uses: actions/download-artifact@v3
10377
with:
104-
profile: minimal
105-
toolchain: stable
106-
override: true
107-
- name: cargo publish
108-
continue-on-error: true
109-
run: cargo publish --token ${CRATESIO_TOKEN}
78+
name: russimp-packages
79+
path: ${{ runner.temp }}/russimp-package
80+
81+
- name: List artifacts
82+
run: |
83+
echo "Received artifacts:"
84+
ls -l $RUSSIMP_PACKAGE_DIR
85+
env:
86+
RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package
87+
88+
- name: Publish release on GitHub
89+
uses: softprops/action-gh-release@v1
90+
with:
91+
generate_release_notes: true
92+
body: |
93+
This release was automatically created by GitHub Actions.
94+
files: |
95+
${{ env.RUSSIMP_PACKAGE_DIR }}/*
96+
token: ${{ secrets.ACCESS_TOKEN }}
97+
env:
98+
RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package
99+
100+
- name: Publish release on crates.io
101+
run: cargo publish --features prebuilt --token $CRATES_IO_TOKEN
102+
env:
103+
CRATES_IO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
104+
RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package

.github/workflows/test.yml

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,58 @@
11
name: Test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- '!v*' # Exclude tags starting with 'v'
9+
pull_request:
410

511
env:
612
CARGO_TERM_COLOR: always
713

814
jobs:
9-
lin-build:
10-
runs-on: ubuntu-latest
15+
test:
16+
name: Test
17+
runs-on: ${{ matrix.target.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
target:
22+
- os: ubuntu-latest
23+
triple: x86_64-unknown-linux-gnu
24+
- os: macos-latest
25+
triple: x86_64-apple-darwin
26+
- os: windows-latest
27+
triple: x86_64-pc-windows-msvc
28+
features: [ 'build-assimp', 'static-link' ]
1129
steps:
12-
- uses: actions/checkout@v2
13-
- name: Install assimp
14-
run: sudo bash ${GITHUB_WORKSPACE}/install_assimp.bash
15-
- name: Install stable
16-
uses: actions-rs/toolchain@v1
30+
- name: Checkout
31+
uses: actions/checkout@v3
1732
with:
18-
profile: minimal
19-
toolchain: stable
20-
override: true
21-
- name: Build
22-
run: cargo build --verbose
23-
- name: Run tests
24-
run: cargo test --lib --verbose
33+
submodules: true
2534

26-
win-build:
27-
runs-on: windows-latest
28-
steps:
29-
- name: Set up Visual Studio shell
30-
uses: egor-tensin/vs-shell@v2
31-
- name: Set up LIBCLANG_PATH
32-
run: echo "LIBCLANG_PATH=$env:VCINSTALLDIR\Tools\Llvm\x64\bin" >> $env:GITHUB_ENV
33-
- uses: actions/checkout@v2
34-
- name: Install stable
35-
uses: actions-rs/toolchain@v1
35+
# LLVM comes preinstalled on Windows and macOS runners
36+
- name: Install LLVM
37+
if: runner.os == 'Linux'
38+
uses: KyleMayes/install-llvm-action@v1
3639
with:
37-
profile: minimal
38-
toolchain: stable
39-
override: true
40-
- name: install cargo-vcpkg
41-
run: cargo install cargo-vcpkg
42-
- name: vcpkg build
43-
run: cargo vcpkg build
44-
- name: Build
45-
run: cargo build --verbose
46-
- name: Run tests
47-
run: cargo test --lib --verbose
40+
directory: ${{ runner.temp }}/llvm
41+
cached: true
42+
version: '14.0'
43+
44+
# CMake and Rust are preinstalled on all runners.
45+
46+
- name: Update Rust
47+
run: |
48+
rustup update stable
49+
rustup target add ${{ matrix.target.triple }}
50+
51+
- name: Cache Rust
52+
uses: Swatinem/rust-cache@v2
4853

49-
macos-build:
50-
runs-on: macos-latest
51-
steps:
52-
- uses: actions/checkout@v2
53-
- name: Install assimp
54-
run: brew install assimp
55-
- name: Install stable
56-
uses: actions-rs/toolchain@v1
57-
with:
58-
profile: minimal
59-
toolchain: stable
60-
override: true
6154
- name: Build
62-
run: cargo build --verbose
63-
- name: Run tests
64-
run: cargo test --lib --verbose
55+
run: cargo build --target ${{ matrix.target.triple }} --features ${{ matrix.features }}
56+
57+
- name: Test
58+
run: cargo test --target ${{ matrix.target.triple }} --features ${{ matrix.features }}

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "assimp"]
22
path = assimp
33
url = https://github.com/assimp/assimp
4+
branch = "master"

Cargo.toml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
11
[package]
22
name = "russimp-sys"
3-
version = "1.0.3"
3+
version = "2.0.0"
44
authors = ["Jhonny Knaak de Vargas"]
5-
edition = "2018"
5+
edition = "2021"
66
license-file = "LICENSE"
77
readme = "README.md"
88
homepage = "https://github.com/jkvargas/russimp-sys"
99
categories = ["rendering", "external-ffi-bindings", "game-engines", "multimedia"]
1010
keywords = ["assimp", "3d", "blend", "3ds", "glTF"]
1111
repository = "https://github.com/jkvargas/russimp-sys"
12-
description = "Raw Assimp bindings for rust"
12+
description = "Raw Assimp bindings for Rust"
1313
exclude = ["/assimp", "*.bash", "*.ps1"]
1414

1515
[lib]
1616
name = "russimp_sys"
1717
path = "src/lib.rs"
18+
doctest = false
19+
20+
[[bin]]
21+
name = "package"
22+
path = "bin/package/main.rs"
1823

1924
[features]
2025
default = []
21-
prebuilt = ["static-link"]
22-
static-link = []
23-
nozlib = []
24-
nolibcxx = []
25-
26-
[build-dependencies]
27-
bindgen = "0.59.2"
28-
vcpkg = "0.2.15"
29-
ureq = "2.5"
30-
serde_json = "1.0"
31-
serde = { version = "1.0", features = ["derive"] }
32-
tar = "0.4"
33-
flate2 = "1.0"
34-
num_cpus = "1.13"
26+
build-assimp = []
27+
prebuilt = []
28+
static-link = ["build-assimp"]
3529

36-
[package.metadata.vcpkg]
37-
git = "https://github.com/microsoft/vcpkg"
38-
rev = "7178ff9"
30+
[dependencies]
31+
flate2 = "1.0.25"
32+
tar = "0.4.38"
3933

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

0 commit comments

Comments
 (0)