Skip to content

Commit

Permalink
refined github action, and execute layout.sh in build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhfan committed Jun 19, 2024
1 parent 5d172bd commit dc9ab5a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 38 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,13 @@ jobs:

#- name: Install toolchain
# uses: dtolnay/rust-toolchain@stable
#
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# #toolchain: ${{ matrix.rust }}
# #target: ${{ matrix.target }}
# #profile: minimal
# #override: true

#- uses: Swatinem/rust-cache@v2
- uses: actions/cache@v3

- name: Checkout repository
uses: actions/checkout@v4
- run: 3rdparty/layout.sh

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -65,11 +61,6 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Checkout repository
uses: actions/checkout@v3

- run: 3rdparty/layout.sh

- name: Run tests
# uses: taiki-e/install-action@nextest
run: cargo t -F "evg,b2d,ftg,ovg,nvg,ugl" -- --nocapture #cargo nextest r
Expand All @@ -95,12 +86,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- run: rustup toolchain install nightly --profile minimal --component llvm-tools
- uses: Swatinem/rust-cache@v2 # should be after rustup

- uses: taiki-e/install-action@cargo-llvm-cov # https://github.com/taiki-e/cargo-llvm-cov
- name: Generate code coverage # https://github.com/actions-rs/tarpaulin
#env:
# CC: clang
Expand All @@ -116,9 +107,9 @@ jobs:
# run-types: 'Tests,Doctests'

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
# token: ${{secrets.CODECOV_TOKEN}} # not required for public repos
token: ${{secrets.CODECOV_TOKEN}} # not required for public repos
# fail_ci_if_error: true
files: lcov.info

Expand Down
29 changes: 14 additions & 15 deletions 3rdparty/layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@
CUR=$(dirname $(readlink -f $0)) && cd $CUR && mkdir -p evg/gpac ftg/stroke
echo "Layout 3rdparty libraries..."

B2D_GIT=https://github.com/blend2d/blend2d.git
B2D_GIT=https://github.com/mhfan/blend2d # patch to use single precision floating point instead
[ -e asmjit ] || git clone https://github.com/asmjit/asmjit.git
[ -e blend2d ] || git clone $B2D_GIT

GPAC=~/Devel/gpac
FT2=~/Devel/freetype2
FT2_GIT=https://git.savannah.gnu.org/git/freetype/freetype2.git
FT2_GIT=https://github.com/mhfan/freetype2
GPAC_GIT=https://github.com/gpac/gpac.git
GPAC_GIT=https://github.com/mhfan/gpac # patch to fix for GPAC_FIXED_POINT

[ -d $GPAC ] || { git clone $GPAC_GIT && GPAC=$CUR/gpac; }
[ -d $FT2 ] || { git clone $FT2_GIT && FT2=$CUR/freetype2; }

[ -e ftg/ftgrays.c ] || {
ln -s $FT2/{include/freetype/ftimage.h,src/smooth/ftgrays.[ch],src/raster/ft{misc.h,raster.c}} ftg/;
ln -s $FT2/src/{raster/ftmisc.h,base/ft{stroke,trigon}.c} ftg/stroke/;
ln -s $FT2/include/freetype/ft{stroke,trigon,image}.h ftg/stroke/;
}

[ -e evg/ftgrays.c ] || {
ln -s $GPAC/src/evg/{ftgrays.c,rast_soft.h,stencil.c,surface.c,raster_{argb,rgb,565,yuv}.c,raster3d.c} evg/;
Expand All @@ -32,11 +26,16 @@ ln -s $GPAC/include/gpac/{evg,setup,constants,maths,color,path2d,tools,thread}.h
touch evg/gpac/{Remotery,config_file,configuration,main,module,version}.h;
}

B2D_GIT=https://github.com/blend2d/blend2d.git
B2D_GIT=https://github.com/mhfan/blend2d # patch to use single precision floating point instead
FT2=~/Devel/freetype2
FT2_GIT=https://git.savannah.gnu.org/git/freetype/freetype2.git
FT2_GIT=https://github.com/mhfan/freetype2
[ -d $FT2 ] || { git clone $FT2_GIT && FT2=$CUR/freetype2; }

[ -e blend2d ] || git clone $B2D_GIT
[ -e asmjit ] || git clone https://github.com/asmjit/asmjit.git
[ -e ftg/ftgrays.c ] || {
ln -s $FT2/{include/freetype/ftimage.h,src/smooth/ftgrays.[ch],src/raster/ft{misc.h,raster.c}} ftg/;
ln -s $FT2/src/{raster/ftmisc.h,base/ft{stroke,trigon}.c} ftg/stroke/;
ln -s $FT2/include/freetype/ft{stroke,trigon,image}.h ftg/stroke/;
}

[ -e micro-gl ] || git clone https://github.com/micro-gl/micro-gl.git

Expand Down
7 changes: 4 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rustc-env=BUILD_GIT_HASH={}", String::from_utf8(output.stdout)?);
println!("cargo:rerun-if-changed={}", Path::new(".git").join("index").display());

//std::process::Command::new(Path::new("3rdparty").join("layout.sh")).status()?;
std::process::Command::new(Path::new("3rdparty").join("layout.sh")).status()?;
#[allow(unused)] let path = std::path::PathBuf::from(env::var("OUT_DIR")?);
#[cfg(feature = "ftg")] binding_ftg(&path)?;
#[cfg(feature = "evg")] binding_evg(&path)?;
#[cfg(feature = "b2d")] binding_b2d(&path)?;
#[cfg(feature = "evg")] binding_evg(&path)?;

#[cfg(feature = "ftg")] binding_ftg(&path)?;
#[cfg(feature = "ovg")] binding_ovg(&path)?;
#[cfg(feature = "ugl")] binding_ugl(&path)?;

Expand Down

0 comments on commit dc9ab5a

Please sign in to comment.