diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 79c3b51e..3308d5e4 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -1,13 +1,13 @@ name: 🏁 Linux Builds on: push: - branches: [ master, main, github_actions_brook ] + branches: [ master, main ] env: BUILD_TYPE: release jobs: - windows-compilation: + linux-compilation: name: Linux Compilation runs-on: "ubuntu-20.04" steps: @@ -43,5 +43,47 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v1 with: - name: win64 - path: build/bin/ \ No newline at end of file + name: linux + path: build/bin/ + + linux-ink-proof: + name: Ink Proof Page Generation + runs-on: "ubuntu-latest" + needs: "linux-compilation" + + steps: + # Checkout project with submodules + - uses: actions/checkout@v2 + with: + submodules: true + + # Download build result from previous step + - uses: actions/download-artifact@v2 + with: + name: linux + path: build + + # Setup python + - uses: actions/setup-python@v2 + with: + python-version: '3.7' + + # Run ink proof + - name: Build Ink Proof Website + shell: bash + run: | + cd $GITHUB_WORKSPACE/proofing/ink-proof + python3 install_deps.py + cp ../inkcpp_runtime_driver drivers/ + chmod +x drivers/inkcpp_runtime_driver + mkdir deps/inkcpp + cp $GITHUB_WORKSPACE/build/bin/* deps/inkcpp/ + chmod +x deps/inkcpp/inkcpp_cl + python3 proof.py --examples 'I0..' inkcpp inklecate_v0.9.0 --reference-runtime inkcpp + + - name: Deploy Page + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: inkproof-page + FOLDER: proofing/ink-proof/out \ No newline at end of file diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index 23442d53..a0d29f15 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -43,5 +43,5 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v1 with: - name: win64 + name: macos path: build/bin/ \ No newline at end of file diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 3c1af122..bab25f55 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -1,7 +1,7 @@ name: 🏁 Windows Builds on: push: - branches: [ master, main, github_actions_brook ] + branches: [ master, main ] env: BUILD_TYPE: release diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fa05f404 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "proofing/ink-proof"] + path = proofing/ink-proof + url = https://github.com/chromy/ink-proof.git diff --git a/README.md b/README.md index 951342b7..aae2ebcb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # inkcpp Inkle Ink C++ Runtime with JSON -> Binary Compiler. +Ink Proofing Test Results: https://brwarner.github.io/inkcpp + ## Project Goals * Fast, simple, clean syntax * No heap allocations during execution (unless in emergencies) diff --git a/inkcpp_cl/inkcpp_cl.cpp b/inkcpp_cl/inkcpp_cl.cpp index 46b02e79..abc021a0 100644 --- a/inkcpp_cl/inkcpp_cl.cpp +++ b/inkcpp_cl/inkcpp_cl.cpp @@ -54,7 +54,7 @@ int main(int argc, const char** argv) } else { - std::cerr << "Unrecognized option '" << option << "'\n"; + std::cerr << "Unrecognized option: '" << option << "'\n"; } } @@ -87,13 +87,22 @@ int main(int argc, const char** argv) std::string jsonFile = std::regex_replace(inputFilename, std::regex("\\.[^\\.]+$"), ".tmp"); // Then we need to do a compilation with inklecate - inklecate(inputFilename, jsonFile); + try + { + inklecate(inputFilename, jsonFile); + } + catch (const std::exception& e) + { + std::cerr << "Inklecate Error: " << e.what() << std::endl; + return 1; + } // New input is the json file inputFilename = jsonFile; } // Open file and compile + try { ink::compiler::compilation_results results; std::ofstream fout(outputFilename, std::ios::binary | std::ios::out); @@ -112,11 +121,17 @@ int main(int argc, const char** argv) return -1; } } + catch (std::exception& e) + { + std::cerr << "Unhandled InkBin compiler exception: " << e.what() << std::endl; + return 1; + } if (!playMode) return 0; // Run the story + try { using namespace ink::runtime; @@ -152,4 +167,9 @@ int main(int argc, const char** argv) return 0; } + catch (const std::exception& e) + { + std::cerr << "Unhandled ink runtime exception: " << e.what() << std::endl; + return 1; + } } \ No newline at end of file diff --git a/proofing/README.md b/proofing/README.md new file mode 100644 index 00000000..62b002ef --- /dev/null +++ b/proofing/README.md @@ -0,0 +1,3 @@ +In the future, there'll be machinery in here to run the ink-proof tests as a test phase during build. For now, it just houses the ink-proof submodule so we can generate the HTML page for it on master. + +See windows_builds.yml in the .github folder \ No newline at end of file diff --git a/proofing/ink-proof b/proofing/ink-proof new file mode 160000 index 00000000..6edca4aa --- /dev/null +++ b/proofing/ink-proof @@ -0,0 +1 @@ +Subproject commit 6edca4aad0ee1bf0b141db2223094403fad72a1f diff --git a/proofing/inkcpp_runtime_driver b/proofing/inkcpp_runtime_driver new file mode 100644 index 00000000..5db41602 --- /dev/null +++ b/proofing/inkcpp_runtime_driver @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +import sys +import shutil + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PATH = os.path.join(ROOT, 'deps', 'inkcpp', 'inkcpp_cl') +ARGS = ["inkcpp_cl", "-p"] + sys.argv[1:] +os.execv(PATH, ARGS) +sleep(2) +