diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..bfdd843 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,32 @@ +name: Build +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Setup Rust Toolchain + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --no-modify-path -y + # the target comes from running `rustup target list` on the Olimex board + rustup target add armv7-unknown-linux-gnueabihf + cargo install cross --git https://github.com/cross-rs/cross + sudo apt-get install -y gcc-arm-linux-gnueabihf + - name: Build + run: cross build --release --target=armv7-unknown-linux-gnueabihf + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/eye + diff --git a/Cargo.toml b/Cargo.toml index e7f9460..45323a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,3 +26,9 @@ shrinkwraprs = "0.2" thiserror = "1.0" time = "0.2" walkdir = "2" + +[workspace.metadata.cross.target.armv7-unknown-linux-gnueabihf] +pre-build = [ + "dpkg --add-architecture $CROSS_DEB_ARCH", + "apt-get update && apt-get --assume-yes install libpq-dev:$CROSS_DEB_ARCH" +]