asyncapi / .github

Location of all reusable community health files
29 stars 65 forks source link

if-nodejs-pr-testing.yml does not test on Windows #278

Closed jonaslagoni closed 6 months ago

jonaslagoni commented 6 months ago

Problem workflow: https://github.com/asyncapi/.github/blob/3b278694c3d0850004e1e0e458779252195a5058/.github/workflows/if-nodejs-pr-testing.yml#L19

The following code is not compatible with Windows:

      - if: >
          !github.event.pull_request.draft && !(
            (github.actor == 'asyncapi-bot' && (
              startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || 
              startsWith(github.event.pull_request.title, 'chore(release):')
            )) ||
            (github.actor == 'asyncapi-bot-eve' && (
              startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || 
              startsWith(github.event.pull_request.title, 'chore(release):')
            )) ||
            (github.actor == 'allcontributors[bot]' && 
              startsWith(github.event.pull_request.title, 'docs: add')
            )
          )
        id: should_run
        name: Should Run
        run: echo "shouldrun=true" >> $GITHUB_OUTPUT

More specifically, I think the problem lies with run: echo "shouldrun=true" >> $GITHUB_OUTPUT.

We have two options as I see it.

  1. We change the run command to be compatible with any system
  2. We remove the check entirely.

Not sure which is the best approach.

derberg commented 6 months ago

thanks for reporting

we cannot remove the check as then we are back in problem that PR tests run on every single PR, even these from bots where PR test is not needed - so yeah - our CI will cry

we need to improve check and basically have different approach if os is windows

looks like in general a known issue -> https://github.com/actions/runner/issues/2224

most voted solution is https://github.com/actions/runner/issues/2224 but to be honest adding shell: bash sounds best for me, as I understand it means that bash is then enforced to use also in windows.

@jonaslagoni the best approach would be if you could apply the fix first in your repo, and if it works there, then we can push fix through here? thoughts?

jonaslagoni commented 6 months ago

Trying here: https://github.com/asyncapi/modelina/pull/1912

jonaslagoni commented 6 months ago

@derberg seems like it works: https://github.com/asyncapi/modelina/actions/runs/8450691764/job/23147412309?pr=1912

derberg commented 6 months ago

oh, yeah, thanks

I also noticed we already use this approach in another step https://github.com/asyncapi/.github/blob/master/.github/workflows/if-nodejs-pr-testing.yml#L48