Skip to content

Commit

Permalink
Nim 2 support
Browse files Browse the repository at this point in the history
Fixes samdze#17
  • Loading branch information
Nycto committed Mar 26, 2024
1 parent e821061 commit 28b0cb5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/actions/build-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: Common build setup
inputs:
nim-version:
required: true
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -34,7 +37,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
Expand All @@ -54,4 +57,5 @@ runs:

- name: Locally publish playdate nimble package
shell: bash
run: nimble develop
if: ${{ startsWith(inputs.nim-version, '1.') }}
run: nimble develop
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ 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:
nim-version: ${{ matrix.nim-version }}
- uses: ./.github/actions/project-setup
with:
working-directory: ./playdate_example
Expand All @@ -20,20 +23,30 @@ 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:
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

- uses: ./.github/actions/build-setup
with:
nim-version: ${{ matrix.nim-version }}

- uses: ./.github/actions/project-setup
with:
Expand All @@ -46,6 +59,7 @@ jobs:
# of warnings to be emitted. This set of commands sets up a dummy audio sink that silences those warnings.
- name: Setup audio sink
run: |
export HOME="/config"
pulseaudio -D --exit-idle-time=-1
pactl load-module module-null-sink sink_name=SpeakerOutput sink_properties=device.description="Dummy_Output"
Expand All @@ -57,7 +71,7 @@ jobs:
# alert from showing in the first place
- name: Create simulator ini
run: |
export PD_INI_DIR="$HOME/.config/Playdate Simulator"
export PD_INI_DIR="/config/.config/Playdate Simulator"
mkdir -p "$PD_INI_DIR"
export PD_INI_FILE="$PD_INI_DIR/Playdate Simulator.ini"
echo "ShowPerfWarning=0" > $PD_INI_FILE
Expand All @@ -66,4 +80,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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
7 changes: 7 additions & 0 deletions playdate_example/nimble.develop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": 1,
"includes": [],
"dependencies": [
".."
]
}
7 changes: 7 additions & 0 deletions tests/nimble.develop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": 1,
"includes": [],
"dependencies": [
".."
]
}

0 comments on commit 28b0cb5

Please sign in to comment.