From d2dd20fe9655809093e9d2ce6c69893b9042ff57 Mon Sep 17 00:00:00 2001
From: mitchmindtree <mitchell.nordine@gmail.com>
Date: Thu, 25 Jun 2020 11:09:30 +0200
Subject: [PATCH] Add a github action to check cross-compilation from Linux

---
 .github/workflows/coreaudio-sys.yml | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/.github/workflows/coreaudio-sys.yml b/.github/workflows/coreaudio-sys.yml
index aecdee2..a288696 100644
--- a/.github/workflows/coreaudio-sys.yml
+++ b/.github/workflows/coreaudio-sys.yml
@@ -37,6 +37,28 @@ jobs:
     - name: cargo doc - all features
       run: cargo doc --all-features --verbose
 
+  # Check that cross-compilation from linux is working.
+  # TODO: This is adapted from old travis file, should probably also:
+  # - Check more feature permutations.
+  # - Use more recent SDK? Looks like 10.13 is used atm.
+  # - Check iOS target?
+  linux-cross-compile:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Install stable
+      uses: actions-rs/toolchain@v1
+      with:
+        profile: minimal
+        toolchain: stable
+        override: true
+    - name: Add apple target
+      run: rustup target add x86_64-apple-darwin
+    - name: Download SDK
+      run: curl -sL https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.13.sdk.tar.xz | tar -Jxf -; export COREAUDIO_SDK_PATH="$PWD/MacOSX10.13.sdk"
+    - name: Cargo build
+      run: cargo build --verbose --target=x86_64-apple-darwin
+
   # Publish a new version when pushing to master.
   # Will succeed if the version has been updated, otherwise silently fails.
   cargo-publish: