Merge pull request #88 from tstein/master #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-buildtest-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install libosmesa6-dev | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: RUST_BACKTRACE=1 cargo test --verbose | |
package: | |
needs: [build] | |
name: Package | |
runs-on: ubuntu-18.04 | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install packages | |
# This is all BS to get random dependencies to cross compile and I hate it | |
run: | | |
sudo cp .github/workflows/sources.list /etc/apt/sources.list | |
sudo dpkg --add-architecture arm64 | |
sudo dpkg --add-architecture armhf | |
sudo apt-get update | |
sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu g++-arm-linux-gnueabihf g++-aarch64-linux-gnu libc-dev-armhf-cross libc-dev-arm64-cross libfreetype6-dev:arm64 libfreetype6-dev:armhf libfontconfig-dev:arm64 libfontconfig-dev:armhf | |
- name: Prep build environment | |
run: | | |
if [ ${{ matrix.target }} == "armv7-unknown-linux-gnueabihf" ]; | |
then | |
export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf | |
elif [ ${{ matrix.target }} == "aarch64-unknown-linux-gnu" ]; | |
then | |
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu | |
fi | |
rustup target add ${{ matrix.target }} | |
cargo install cargo-deb --force | |
- name: Package | |
run: cargo deb --target ${{ matrix.target }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: deb-${{ matrix.target }} | |
path: target/${{ matrix.target }}/debian/*.deb |