get-playdate-sdk icon indicating copy to clipboard operation
get-playdate-sdk copied to clipboard

Windows, how to use environment variable?

Open ninovanhooff opened this issue 1 year ago • 1 comments

This action fails while the env var seems to be set allright. Is that because the env var is only set in git bash and I'm not using that?

https://github.com/ninovanhooff/LibHEBitmap/actions/runs/8930413593/job/24530460948

Relevant CmakeLists.txt error: https://github.com/ninovanhooff/LibHEBitmap/blob/3df3c67818640d6004d43bd098fe2ed96ccc6552/CMakeLists.txt#L20

My workflow: https://github.com/ninovanhooff/LibHEBitmap/actions/runs/8930413593/workflow

ninovanhooff avatar May 02 '24 21:05 ninovanhooff

Hi @ninovanhooff 👋 We're using bash everywhere. There is real usage example.

You're right, env var PLAYDATE_SDK_PATH is set from bash but should be set not only for bash. If you want it in another shel such as powershell or cmd, you can get the path of SDK from action' outputs, like this:

- id: sdk
  uses: # this action
...
# You can use ${{ steps.sdk.outputs.root }} or ${{ env.PLAYDATE_SDK_PATH }}.
# This is for pwsh:
- run: echo "PLAYDATE_SDK_PATH=${{ steps.sdk.outputs.root }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
  shell: pwsh

Or for your case, I could try to add there and there env var via GitHub's api:

- name: Configure CMake
  env: # this 👇
    PLAYDATE_SDK_PATH: ${{ steps.sdk.outputs.root }}
  # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  run: >
    cmake -B ${{ steps.strings.outputs.build-output-dir }}
    ...

I didn't tested this way, but supposed to work according to GH's docs.

Anyway, that's strange, IMHO, because I writing env in normal way that recommended by GH (1, 2, 3).


That is strange, I see that env already set in your workflow. See this linux win lines.

Screenshot 2024-05-05 at 02 43 57

And on linux CMake wants you to set env var CMAKE_MAKE_PROGRAM there.

boozook avatar May 04 '24 22:05 boozook

Seems to paths in env are not UNC or old win format, so pwsh breaks on them.

boozook avatar May 22 '24 00:05 boozook

Fixed.

  • https://github.com/ninovanhooff/LibHEBitmap/pull/1
  • Check.

boozook avatar Jun 27 '24 09:06 boozook

fixed in https://github.com/pd-rs/get-playdate-sdk/pull/35

boozook avatar Jun 27 '24 13:06 boozook

Thank you very much, my build is fixed!

ninovanhooff avatar Jul 06 '24 10:07 ninovanhooff