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 17, 2024
1 parent d21b779 commit 2d3d2a2
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 10 deletions.
22 changes: 18 additions & 4 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 All @@ -7,6 +10,21 @@ runs:
shell: bash
run: git config --global --add safe.directory "$(pwd)"

- name: Install Nim
shell: bash
run: choosenim -y update ${{ inputs.nim-version }}

- run: nimble --accept refresh
shell: bash

- run: nimble install
shell: bash

- name: Locally publish playdate nimble package
shell: bash
if: ${{ startsWith(inputs.nim-version, '1.') }}
run: nimble develop

# Some of the apt dependencies require input from the installer. This disables those
# prompts so we can do a headless install
- name: Force non-interactive apt installations
Expand All @@ -28,7 +46,3 @@ runs:
- name: Set PLAYDATE_SDK_PATH
shell: bash
run: echo "PLAYDATE_SDK_PATH=$(readlink -f $(find PlaydateSDK-* -maxdepth 0 -type d))" >> "$GITHUB_ENV"

- name: Locally publish playdate nimble package
shell: bash
run: nimble develop
27 changes: 22 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ jobs:

example-project:
runs-on: ubuntu-latest
container: nimlang/nim
container: nimlang/choosenim
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 @@ -19,21 +22,31 @@ jobs:

tests:
runs-on: ubuntu-latest
container: nimlang/nim
container: nimlang/choosenim
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: nimlang/nim
container: nimlang/choosenim
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,12 +71,15 @@ 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
echo "ShowElist=0" >> $PD_INI_FILE
echo "LastRelease=$(cat PlaydateSDK-*/VERSION.txt)" >> $PD_INI_FILE
- run: xvfb-run ../PlaydateSDK-*/bin/PlaydateSimulator tests.pdx
- name: Run headless test
working-directory: ./tests
run: |
export HOME="/config"
xvfb-run ../PlaydateSDK-*/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 2d3d2a2

Please sign in to comment.