Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #36

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 40 additions & 19 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ defaults:

env:
cratename: polylabel
MACOSX_DEPLOYMENT_TARGET: 10.9
rustflags: -C rpath

name: Test and Build

jobs:
test:
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags/')
name: Test on ${{ matrix.os }}
name: Test on ${{ matrix.os }} (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -25,10 +25,11 @@ jobs:
target: x86_64-unknown-linux-gnu
use-cross: false
- build: macos
os: macos-11
os: macos-latest
rust: stable
target: x86_64-apple-darwin
use-cross: false
deptarget: 10.9
- build: windows
os: windows-latest
rust: stable
Expand All @@ -41,14 +42,16 @@ jobs:
toolchain: stable
target: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deptarget }}
with:
use-cross: ${{ matrix.use-cross }}
command: test
args: --target=${{ matrix.target }}

build:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Build and release on ${{ matrix.os }}
name: Build and release on ${{ matrix.os }} (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -59,27 +62,49 @@ jobs:
rust: stable
target: x86_64-unknown-linux-gnu
use-cross: true
- build: linux
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
use-cross: true
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
use-cross: false
deptarget: 10.9
- build: macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
use-cross: false
deptarget: 11.0
- build: windows
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
use-cross: false
steps:
- name: Switch to macOS 13.x SDK
if: matrix.target == 'aarch64-apple-darwin'
run: |
xcodebuild -showsdks
SDKROOT=$(xcrun -sdk macosx13.1 --show-sdk-path)
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deptarget }}
with:
use-cross: ${{ matrix.use-cross }}
command: build
args: --release --target=${{ matrix.target }} --features headers,ffi
args: --release --target=${{ matrix.target }} --features headers
- name: Install aarch64 related packages
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu qemu-system-arm
- name: Gather Assets
run: |
src=$(pwd)
Expand All @@ -106,21 +131,27 @@ jobs:
echo "TYPE=tar" >> $GITHUB_ENV
echo "EXTENSION=tar.gz" >> $GITHUB_ENV
for lib in target/${{ matrix.target }}/release/*.so; do
strip -s $lib
if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
aarch64-linux-gnu-strip -s $lib
else
strip -s $lib
fi
done
cp target/${{ matrix.target }}/release/*.so $stage/
fi
if [ "$RUNNER_OS" == "macOS" ]; then
echo "TYPE=tar" >> $GITHUB_ENV
echo "EXTENSION=tar.gz" >> $GITHUB_ENV
for lib in target/${{ matrix.target }}/release/*.dylib; do
install_name_tool -id "@rpath/lib${{ env.cratename }}.dylib" $lib
otool -L $lib
strip -ur $lib
done
cp target/${{ matrix.target }}/release/*.dylib $stage/
fi
if [ "$RUNNER_OS" == "Windows" ]; then
echo "TYPE=zip" >> $GITHUB_ENV
echo "EXTENSION=zip" >> $GITHUB_ENV
echo "TYPE=tar" >> $GITHUB_ENV
echo "EXTENSION=tar.gz" >> $GITHUB_ENV
cp target/${{ matrix.target }}/release/deps/${{ env.cratename }}.dll.lib target/${{ matrix.target }}/release/deps/${{ env.cratename }}.lib
cp target/${{ matrix.target }}/release/${{ env.cratename }}* $stage/
cp target/${{ matrix.target }}/release/deps/${{ env.cratename }}* $stage/
Expand All @@ -129,23 +160,13 @@ jobs:
ls $stage
cd $src

- name: Create macOS and Linux Archive
if: runner.os != 'Windows'
- name: Create archive
run: |
pushd ${{ env.STAGE }}
tar -czf "${{ env.ASSET_NAME }}.${{ env.EXTENSION }}" *
popd
cp "${{ env.STAGE }}/${{ env.ASSET_NAME }}.${{ env.EXTENSION }}" zipped/

- name: Create Windows Archive
if: runner.os == 'Windows'
uses: thedoctor0/zip-release@master
with:
type: ${{ env.TYPE }}
filename: "${{ env.ASSET_NAME }}.${{ env.EXTENSION }}"
path: ${{ env.STAGE }}/*.*
directory: zipped

- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.x86_64-unknown-linux-gnu]
image = "quay.io/pypa/manylinux2014_x86_64"

[target.aarch64-unknown-linux-gnu]
image = "dockcross/manylinux2014-aarch64"
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ An auto-generated header file is available at [`include/header.h`](include/heade
Using a 4-core 2.3 GHz Intel Core i5, finding a label position on a ~9k-vertex polygon (representing the Norwegian mainland) using a tolerance of `1.0` takes around 9 ms. Depending upon the dimensions of your polygon(s), you may require a higher tolerance (i.e. a smaller number). See [here](https://gis.stackexchange.com/questions/8650/measuring-accuracy-of-latitude-and-longitude/8674#8674) for some guidance on the accuracy provided by each decimal place.

## Binaries
Binary libs for:
- `x86_64` *nix (built using `manylinux1`, thus easy to include in Python 2.7 / 3.5 / 3.6 wheels) and OS X
- `i686` and `x86_64` Windows

are available in [releases](https://github.com/urschrei/polylabel-rs/releases).

## License
Expand Down
Loading