name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
jobs:
format:
runs-on: ubuntu-20.04
steps:
- name: Install stable toolchain with rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
- uses: actions/checkout@v1
- name: Rustfmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: fdp
- name: Clone Icebox repository
uses: actions/checkout@v2
with:
repository: thalium/icebox
path: icebox
- name: Compile and install FDP library
run: |
g++ -std=c++11 -shared -fPIC FDP.cpp -o libFDP.so
sudo cp include/* /usr/local/include
sudo cp libFDP.so /usr/local/lib
working-directory: icebox/src/FDP
- name: Build
run: cargo build
working-directory: fdp
- name: Run tests
run: cargo test
working-directory: fdp
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
path: fdp
- name: Clone Icebox repository
uses: actions/checkout@v2
with:
repository: thalium/icebox
path: icebox
- name: Setup command prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1
- name: Compile and install FDP library
run: |
cl /LD FDP.cpp /link /out:libFDP.dll
New-Item -Path "$Env:ProgramFiles\FDP" -ItemType "directory"
copy libFDP.dll "$Env:ProgramFiles\FDP"
copy "include\*" "$Env:ProgramFiles\FDP"
dir "$Env:ProgramFiles\FDP"
working-directory: icebox/src/FDP
- name: Install Clang
run: choco install llvm
- name: Build
run: cargo build
working-directory: fdp
env:
BINDGEN_EXTRA_CLANG_ARGS: -I"C:\Program Files\FDP" -L"C:\Program Files\FDP"
publish:
needs: [format, build_linux, build_windows]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Clone Icebox repository
run: git clone https://github.com/thalium/icebox --depth 1
- name: Compile and install FDP library
run: |
cd icebox/src/FDP
g++ -std=c++11 -shared -fPIC FDP.cpp -o libFDP.so
sudo cp include/* /usr/local/include
sudo cp libFDP.so /usr/local/lib
- uses: actions/checkout@v1
- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Publish
shell: bash
run: |
cargo publish --token ${{ secrets.CRATES_TOKEN }}