From fbc1b934315859cdd4b4a1b9cc8fd8dbf352fd79 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Wed, 30 Sep 2020 10:22:52 -0400 Subject: [PATCH] Check that we compile on solaris This also adds infrastructure to make it easier to add more check targets in the future. --- .github/workflows/test.yml | 18 +++++++++++++++- ci/install-cross.sh | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 ci/install-cross.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 575fc2ad..1f1e5d81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: test +name: All Tests and Builds on: push: @@ -116,3 +116,19 @@ jobs: env: RUST_VERSION: stable WASM: wasm_simple + + cross-targets: + strategy: + matrix: + target: + - x86_64-sun-solaris + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install cross + run: bash ci/install-cross.sh + + - name: Build static library + run: cross check --target ${{ matrix.target }} diff --git a/ci/install-cross.sh b/ci/install-cross.sh new file mode 100644 index 00000000..b5786f1f --- /dev/null +++ b/ci/install-cross.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +main() { + local target= + if [[ "$(os)" == "ubuntu-latest" || "$(os)" == Linux ]]; then + target=x86_64-unknown-linux-musl + # shellcheck disable=SC2209 + sort=sort + else + target=x86_64-apple-darwin + sort=gsort + fi + + # This fetches latest stable release + local tag + tag=$(git ls-remote --tags --refs --exit-code https://github.com/rust-embedded/cross \ + | cut -d/ -f3 \ + | grep -E '^v[0.1.0-9.]+$' \ + | $sort --version-sort \ + | tail -n1) + + curl -LSfs https://japaric.github.io/trust/install.sh | \ + sh -s -- \ + --force \ + --git rust-embedded/cross \ + --tag "$tag" \ + --target $target + + cross --version +} + +# get an os name, either github's pre-set one or the result of uname +os() { + if [ -n "${OS_NAME:-}" ]; then + echo "$OS_NAME" + return + fi + uname +} + +main