From 15b0bec79916eafa38916e109665df4d916a1143 Mon Sep 17 00:00:00 2001 From: Nycto Date: Tue, 19 Mar 2024 19:23:40 -0700 Subject: [PATCH] Nim 2 support Fixes #17 --- .github/actions/build-setup/action.yml | 7 +++++-- .github/workflows/build.yml | 14 +++++++++++++- README.md | 2 +- playdate_example/nimble.develop | 7 +++++++ tests/nimble.develop | 7 +++++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 playdate_example/nimble.develop create mode 100644 tests/nimble.develop diff --git a/.github/actions/build-setup/action.yml b/.github/actions/build-setup/action.yml index 9fafd11..02a1b42 100644 --- a/.github/actions/build-setup/action.yml +++ b/.github/actions/build-setup/action.yml @@ -2,6 +2,8 @@ name: Common build setup inputs: headless-simulator-support: required: true + nim-version: + required: true runs: using: "composite" steps: @@ -37,7 +39,7 @@ runs: - name: Install Nim uses: jiro4989/setup-nim-action@v1 with: - nim-version: '1.6.16' + nim-version: ${{ inputs.nim-version }} # Some of the apt dependencies require input from the installer. This disables those # prompts so we can do a headless install @@ -87,4 +89,5 @@ runs: - name: Locally publish playdate nimble package shell: bash - run: nimble develop \ No newline at end of file + if: ${{ startsWith(inputs.nim-version, '1.') }} + run: nimble develop diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa534c9..4057113 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,11 +8,13 @@ jobs: strategy: matrix: target: [ device, simulator ] + nim-version: [ 1.6.16, 2.0.2 ] steps: - uses: actions/checkout@v3 - uses: ./.github/actions/build-setup with: headless-simulator-support: false + nim-version: ${{ matrix.nim-version }} - uses: ./.github/actions/project-setup with: working-directory: ./playdate_example @@ -22,17 +24,24 @@ jobs: tests: runs-on: ubuntu-latest container: node:20 + strategy: + matrix: + nim-version: [ 1.6.16, 2.0.2 ] steps: - uses: actions/checkout@v3 - uses: ./.github/actions/build-setup with: headless-simulator-support: false + nim-version: ${{ matrix.nim-version }} - run: nimble test headless-tests: runs-on: ubuntu-latest timeout-minutes: 5 container: node:20 + strategy: + matrix: + nim-version: [ 1.6.16, 2.0.2 ] steps: - uses: actions/checkout@v3 @@ -40,6 +49,7 @@ jobs: - uses: ./.github/actions/build-setup with: headless-simulator-support: true + nim-version: ${{ matrix.nim-version }} - uses: ./.github/actions/project-setup with: @@ -50,4 +60,6 @@ jobs: - name: Run headless test working-directory: ./tests - run: xvfb-run "$PLAYDATE_SDK_PATH/bin/PlaydateSimulator" tests.pdx + run: | + export HOME="/config" + xvfb-run "$PLAYDATE_SDK_PATH/bin/PlaydateSimulator" tests.pdx diff --git a/README.md b/README.md index caca804..37411c2 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This package is an independent bindings library, not affiliated with Panic. ### Prerequisites - Playdate SDK -- Nim 1.6.10+ (check with `nim -v`, untested with 2.0+) ([recommended extension for VSCode](https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode)) +- Nim 1.6.10+ or Nim 2+ ([recommended extension for VSCode](https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode)) - Nimble 0.13.1 (check with `nimble -v`) - `PLAYDATE_SDK_PATH` environment variable - [SDK Prerequisites](https://sdk.play.date/Inside%20Playdate%20with%20C.html#_prerequisites) based on OS, and [MinGW on Windows](https://code.visualstudio.com/docs/cpp/config-mingw). diff --git a/playdate_example/nimble.develop b/playdate_example/nimble.develop new file mode 100644 index 0000000..49def8e --- /dev/null +++ b/playdate_example/nimble.develop @@ -0,0 +1,7 @@ +{ + "version": 1, + "includes": [], + "dependencies": [ + ".." + ] +} diff --git a/tests/nimble.develop b/tests/nimble.develop new file mode 100644 index 0000000..49def8e --- /dev/null +++ b/tests/nimble.develop @@ -0,0 +1,7 @@ +{ + "version": 1, + "includes": [], + "dependencies": [ + ".." + ] +}