diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81821a29..915ebe28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,16 +17,37 @@ jobs: include: - os: macos-latest artifact: macos + inklecate_url: https://github.com/inkle/ink/releases/download/0.9.0/inklecate_mac.zip - os: windows-latest artifact: win64 + inklecate_url: https://github.com/inkle/ink/releases/download/0.9.0/inklecate_windows_and_linux.zip - os: "ubuntu-20.04" artifact: linux - + inklecate_url: https://github.com/inkle/ink/releases/download/0.9.0/inklecate_windows_and_linux.zip + inklecate_pre: "mono " + inklecate_post: ".exe" + steps: # Checkout project - uses: actions/checkout@v2 + # Download inklecate + - uses: suisei-cn/actions-download-file@v1 + name: Download Inklecate + id: download_inklecate + with: + url: ${{ matrix.inklecate_url }} + target: "inklecate/" + + # Install Inklecate + - name: Deploy Inkelcate + shell: bash + run: | + cd inklecate + unzip *.zip + echo "INKLECATE=${{ matrix.inklecate_pre }}$GITHUB_WORKSPACE/inklecate/inklecate${{ matrix.inklecate_post }}" >> $GITHUB_ENV + # Create a build directory to store all the CMake generated files - name: Create Build Environment run: cmake -E make_directory ${{github.workspace}}/build diff --git a/inkcpp_cl/test.cpp b/inkcpp_cl/test.cpp index 2a37ff2e..663d8795 100644 --- a/inkcpp_cl/test.cpp +++ b/inkcpp_cl/test.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -13,8 +14,21 @@ void inklecate(const std::string& inkFilename, const std::string& jsonFilename) { - std::string command = "inklecate -o " + jsonFilename + " " + inkFilename; - std::system(command.c_str()); + // Get environment specific inklecate invocation command + const char* inklecateCmd = std::getenv("INKLECATE"); + if (inklecateCmd == nullptr) + inklecateCmd = "inklecate"; + + // Create command + std::stringstream cmd; + cmd << inklecateCmd << " -o " << jsonFilename << " " << inkFilename; + + // Run + int result = std::system(cmd.str().c_str()); + if (result != 0) { + std::stringstream msg; msg << "Inklecate failed with exit code " << result; + throw std::runtime_error(msg.str()); + } } void load_file(const std::string& filename, std::string& result)