diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7d703f2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ + +root = true + +[*] +charset = utf-8 +end_of_line = LF +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{markdown,md}] +trim_trailing_whitespace = false diff --git a/.github/source/main.lua b/.github/source/main.lua new file mode 100644 index 0000000..ad88110 --- /dev/null +++ b/.github/source/main.lua @@ -0,0 +1,20 @@ +import "CoreLibs/graphics" + +local gfx = playdate.graphics +local display = playdate.display + +function init() + local message = "Hello World" + local messageWidth, messageHeight = gfx.getTextSize(message) + + gfx.drawText( + message, + (display.getWidth() / 2) - (messageWidth / 2), + (display.getHeight() / 2) - (messageHeight / 2) + ) +end + +init() + +function playdate.update() +end diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0ecb5ed --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ + +name: Tests + +on: + push + +jobs: + test-run: + strategy: + matrix: + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - uses: idleberg/setup-playdate-sdk@main + + - name: Test environment variable + run: | + if [ -z "${PLAYDATE_SDK_PATH}" ]; then + echo "PLAYDATE_SDK_PATH is not defined or empty" + exit 1 + fi + + $PLAYDATE_SDK_PATH/bin/pdc --version + + - name: Print version + run: pdc --version + + - name: Compile game + run: pdc --verbose ${GITHUB_WORKSPACE}/.github/source diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c8440a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pdx +*.pdz diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c36111a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jan T. Sott + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..371d0c8 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# setup-playdate-sdk + +> A GitHub action that installs the Playdate SDK. + +## Usage + +Configure a step that adds the `idleberg/setup-playdate-sdk` action to your workflow. Optionally, you can pass the following parameters via `with` + +See [`test.yml`](https://github.com/idleberg/setup-playdate-sdk/blob/main/.github/workflows/test.yml) for an example. + +### Options + +#### install_sdk + +Default: `true` + +Install Playdate SDK if true + +#### sdk_version + +Default: `latest` + +Specify the version of the SDK + +#### set_env_var + +Default: `true` + +Set `PLAYDATE_SDK_PATH` environment variable + +#### update_path + +Default: `true` + +Update environment variable PATH for workflow if true + +## License + +This work is licensed under [The MIT License](LICENSE). diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..18400f4 --- /dev/null +++ b/action.yml @@ -0,0 +1,34 @@ +name: 'Setup Playdate SDK' +description: 'Setup the Playdate SDK and expose its build tools' +inputs: + install_sdk: + description: 'Install Playdate SDK if true (default)' + required: true + default: 'true' + sdk_version: + description: 'Specify the version of the SDK (defaults to latest)' + required: true + default: 'latest' + set_env_var: + description: 'Set PLAYDATE_SDK_PATH environment variable (default)' + default: 'true' + update_path: + description: 'Update environment variable PATH for workflow if true (default)' + required: true + default: 'true' +runs: + using: "composite" + steps: + - name: 'Setup Playdate SDK' + shell: bash + if: ${{ inputs.install_sdk == 'true' }} + run: | + curl -s https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-${{ inputs.sdk_version }}.tar.gz -L | tar xvzf - -C ${{ runner.temp }} + - name: 'Set PLAYDATE_SDK_PATH environment variable' + shell: bash + if: ${{ inputs.set_env_var == 'true' }} + run: echo "PLAYDATE_SDK_PATH=${{ runner.temp }}/$(ls -t -U ${{ runner.temp }} | grep -m 1 "PlaydateSDK")" >> $GITHUB_ENV + - name: 'Update PATH' + shell: bash + if: ${{ inputs.update_path == 'true' }} + run: echo "${{ runner.temp }}/$(ls -t -U ${{ runner.temp }} | grep -m 1 "PlaydateSDK")/bin" >> $GITHUB_PATH