EnricoMi / publish-unit-test-result-action

GitHub Action to publish unit test results on GitHub
Apache License 2.0
615 stars 184 forks source link

`-m: command not found` during `Install Python dependencies` #570

Closed simendsjo closed 8 months ago

simendsjo commented 8 months ago

We get an error during Python dependency restore:

2024-02-05T11:10:28.7456674Z E:\actions-runner-2\_work\_temp\0541df69-fd06-4c0d-8c60-ad4b9d0f006c.sh: line 3: -m: command not found

I also see other errors in the logs:

2024-02-05T11:10:22.9900852Z E:\actions-runner-2\_work\_temp\150b9c5b-6253-4923-a00d-0532f65cdabc.sh: line 20: C:\Program: No such file or directory

The action use to work. The developer did a re-run of the job if that could be related.

This is our definition:

    - name: Publish Test Results
      # Running the composite version doesn't require Ubuntu as the runner OS
      uses: EnricoMi/publish-unit-test-result-action/composite@v2
      with:
        files: "**/*.trx"

The log:

2024-02-05T11:10:21.4760432Z ##[group]Run EnricoMi/publish-unit-test-result-action/composite@v2
2024-02-05T11:10:21.4760990Z with:
2024-02-05T11:10:21.4761232Z   files: **/*.trx
2024-02-05T11:10:21.4761721Z   github_token: ***
2024-02-05T11:10:21.4762046Z   github_token_actor: github-actions
2024-02-05T11:10:21.4763387Z   github_retries: 10
2024-02-05T11:10:21.4763697Z   check_name: Test Results
2024-02-05T11:10:21.4764022Z   comment_mode: always
2024-02-05T11:10:21.4764335Z   fail_on: test failures
2024-02-05T11:10:21.4764647Z   action_fail: false
2024-02-05T11:10:21.4764967Z   action_fail_on_inconclusive: false
2024-02-05T11:10:21.4765333Z   time_unit: seconds
2024-02-05T11:10:21.4765629Z   report_suite_logs: none
2024-02-05T11:10:21.4765953Z   ignore_runs: false
2024-02-05T11:10:21.4766893Z   check_run: true
2024-02-05T11:10:21.4767197Z   job_summary: true
2024-02-05T11:10:21.4767513Z   compare_to_earlier_commit: true
2024-02-05T11:10:21.4767888Z   pull_request_build: merge
2024-02-05T11:10:21.4768296Z   check_run_annotations: all tests, skipped tests
2024-02-05T11:10:21.4768750Z   seconds_between_github_reads: 0.25
2024-02-05T11:10:21.4769146Z   seconds_between_github_writes: 2.0
2024-02-05T11:10:21.4769563Z   json_thousands_separator:  
2024-02-05T11:10:21.4769929Z   json_suite_details: false
2024-02-05T11:10:21.4770277Z   json_test_case_results: false
2024-02-05T11:10:21.4770645Z   search_pull_requests: false
2024-02-05T11:10:21.4770972Z env:
<REDACTED>
2024-02-05T11:10:21.4773287Z ##[endgroup]
2024-02-05T11:10:21.5899881Z ##[group]Run echo '##[group]Check for Python3'
2024-02-05T11:10:21.5900448Z echo '##[group]Check for Python3'
2024-02-05T11:10:21.5901162Z # we check version here just to execute `python3` with an argument
2024-02-05T11:10:21.5902097Z # on Windows, there is a `python3.exe` that is a proxy to trigger installation from app store
2024-02-05T11:10:21.5903148Z # command `which python3` finds that, but `python3 -V` does not return the version on stdout
2024-02-05T11:10:21.5904148Z if ! which python3 || [[ $(python3 -V) != *"python 3."* && $(python3 -V) != *"Python 3."* ]]
2024-02-05T11:10:21.5904785Z then
2024-02-05T11:10:21.5905317Z   if ! which python || [[ $(python -V) != *"python 3."* && $(python -V) != *"Python 3."* ]]
2024-02-05T11:10:21.5905939Z   then
2024-02-05T11:10:21.5906893Z     echo "::error::No python3 interpreter found. Please setup python before running this action. You could use https://github.com/actions/setup-python."
2024-02-05T11:10:21.5907908Z     exit 1
2024-02-05T11:10:21.5908200Z   fi
2024-02-05T11:10:21.5908453Z 
2024-02-05T11:10:21.5908878Z   PYTHON_BIN=$(python -c 'import sys; print(sys.executable)')
2024-02-05T11:10:21.5909428Z else
2024-02-05T11:10:21.5909876Z   PYTHON_BIN=$(python3 -c 'import sys; print(sys.executable)')
2024-02-05T11:10:21.5910420Z fi
2024-02-05T11:10:21.5910714Z 
2024-02-05T11:10:21.5911495Z echo "Python that creates venv: $PYTHON_BIN"
2024-02-05T11:10:21.5912248Z echo "PYTHON_BIN=$PYTHON_BIN" >> $GITHUB_ENV
2024-02-05T11:10:21.5913086Z echo "version=$($PYTHON_BIN -V)" >> $GITHUB_OUTPUT
2024-02-05T11:10:21.5913681Z echo '##[endgroup]'
2024-02-05T11:10:21.5949504Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2024-02-05T11:10:21.5950130Z env:
<REDACTED>
2024-02-05T11:10:21.5952580Z ##[endgroup]
2024-02-05T11:10:21.8371369Z ##[group]Check for Python3
2024-02-05T11:10:22.0397806Z which: no python3 in <REDACTED>
2024-02-05T11:10:22.2395330Z /c/Program Files/Python311/python
2024-02-05T11:10:22.8906965Z Python that creates venv: C:\Program Files\Python311\python.exe
2024-02-05T11:10:22.9900852Z E:\actions-runner-2\_work\_temp\150b9c5b-6253-4923-a00d-0532f65cdabc.sh: line 20: C:\Program: No such file or directory
2024-02-05T11:10:22.9915812Z ##[endgroup]
2024-02-05T11:10:23.1062676Z ##[group]Run case "$RUNNER_OS" in
2024-02-05T11:10:23.1063114Z case "$RUNNER_OS" in
2024-02-05T11:10:23.1063464Z   Linux*)
2024-02-05T11:10:23.1063885Z     echo "pip-cache=~/.cache/pip" >> $GITHUB_OUTPUT
2024-02-05T11:10:23.1064366Z     ;;
2024-02-05T11:10:23.1064634Z   macOS*)
2024-02-05T11:10:23.1065106Z     echo "pip-cache=~/Library/Caches/pip" >> $GITHUB_OUTPUT
2024-02-05T11:10:23.1065634Z     ;;
2024-02-05T11:10:23.1065908Z   Windows*)
2024-02-05T11:10:23.1066499Z     echo "pip-cache=~\\AppData\\Local\\pip\\Cache" >> $GITHUB_OUTPUT
2024-02-05T11:10:23.1067200Z     echo "pip-options=--user" >> $GITHUB_OUTPUT
2024-02-05T11:10:23.1067658Z     ;;
2024-02-05T11:10:23.1067924Z esac
2024-02-05T11:10:23.1100900Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2024-02-05T11:10:23.1101590Z env:
<REDACTED>
2024-02-05T11:10:23.1104068Z   PYTHON_BIN: C:\Program Files\Python311\python.exe
2024-02-05T11:10:23.1104516Z ##[endgroup]
2024-02-05T11:10:23.4843253Z ##[group]Run actions/cache/restore@v3
2024-02-05T11:10:23.4843652Z with:
2024-02-05T11:10:23.4843929Z   path: ~\AppData\Local\pip\Cache
2024-02-05T11:10:23.4844612Z   key: enricomi-publish-action-Windows-X64-pip--70a313922fdbeb7398ec60313d908b11
2024-02-05T11:10:23.4845330Z   enableCrossOsArchive: false
2024-02-05T11:10:23.4845694Z   fail-on-cache-miss: false
2024-02-05T11:10:23.4846024Z   lookup-only: false
2024-02-05T11:10:23.4846306Z env:
<REDACTED>
2024-02-05T11:10:23.4848921Z   PYTHON_BIN: C:\Program Files\Python311\python.exe
2024-02-05T11:10:23.4849369Z ##[endgroup]
2024-02-05T11:10:25.7079078Z Received 0 of 18468672 (0.0%), 0.0 MBs/sec
2024-02-05T11:10:26.7085021Z Received 5885760 of 18468672 (31.9%), 2.8 MBs/sec
2024-02-05T11:10:26.7869168Z Cache Size: ~18 MB (18468672 B)
2024-02-05T11:10:26.7904009Z [command]"C:\Program Files\Git\usr\bin\tar.exe" -xf E:/actions-runner-2/_work/_temp/a35bb654-041b-4f53-bdd1-853da343f953/cache.tgz -P -C E:/actions-runner-2/_work/<REDACTED>/<REDACTED> --force-local -z
2024-02-05T11:10:27.4474646Z Cache restored successfully
2024-02-05T11:10:27.5093882Z Cache restored from key: enricomi-publish-action-Windows-X64-pip--70a313922fdbeb7398ec60313d908b11
2024-02-05T11:10:27.6288963Z ##[group]Run echo '##[group]Create virtualenv'
2024-02-05T11:10:27.6289643Z echo '##[group]Create virtualenv'
2024-02-05T11:10:27.6290175Z echo "Python that creates venv: $PYTHON_BIN"
2024-02-05T11:10:27.6290639Z 
2024-02-05T11:10:27.6290957Z echo "Creating virtual environment"
2024-02-05T11:10:27.6291880Z if ! $PYTHON_BIN -m virtualenv enricomi-publish-action-venv && ! $PYTHON_BIN -m venv enricomi-publish-action-venv
2024-02-05T11:10:27.6292727Z then
2024-02-05T11:10:27.6293455Z   echo "Looks like there is neither virtualenv nor venv package installed"
2024-02-05T11:10:27.6294364Z   if ! $PYTHON_BIN -m pip install $PIP_OPTIONS virtualenv && [ -n "$PIP_OPTIONS" ]
2024-02-05T11:10:27.6295013Z   then
2024-02-05T11:10:27.6295675Z     echo "Installing virtualenv package with PIP options '$PIP_OPTIONS' failed, now trying without"
2024-02-05T11:10:27.6296675Z     $PYTHON_BIN -m pip install virtualenv
2024-02-05T11:10:27.6297146Z   fi
2024-02-05T11:10:27.6297412Z 
2024-02-05T11:10:27.6297870Z   if ! $PYTHON_BIN -m virtualenv enricomi-publish-action-venv
2024-02-05T11:10:27.6298424Z   then
2024-02-05T11:10:27.6298937Z     echo "Still cannot create venv after installing virtualenv package"
2024-02-05T11:10:27.6299539Z     exit 1
2024-02-05T11:10:27.6299835Z   fi
2024-02-05T11:10:27.6300094Z fi
2024-02-05T11:10:27.6300439Z 
2024-02-05T11:10:27.6300916Z echo "Finding Python interpreter in venv"
2024-02-05T11:10:27.6301476Z case "$RUNNER_OS" in
2024-02-05T11:10:27.6301835Z   Linux*|macOS*)
2024-02-05T11:10:27.6302351Z     PYTHON_VENV="enricomi-publish-action-venv/bin/python";;
2024-02-05T11:10:27.6302910Z   Windows*)
2024-02-05T11:10:27.6303422Z     PYTHON_VENV="enricomi-publish-action-venv\\Scripts\\python";;
2024-02-05T11:10:27.6304087Z esac
2024-02-05T11:10:27.6304610Z PYTHON_VENV=$($PYTHON_VENV -c 'import sys; print(sys.executable)')
2024-02-05T11:10:27.6305413Z echo "Python in venv: $PYTHON_VENV"
2024-02-05T11:10:27.6305941Z echo "PYTHON_VENV=$PYTHON_VENV" >> $GITHUB_ENV
2024-02-05T11:10:27.6306423Z echo '##[endgroup]'
2024-02-05T11:10:27.6340073Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2024-02-05T11:10:27.6340771Z env:
<REDACTED>
2024-02-05T11:10:27.6343453Z   PYTHON_BIN: C:\Program Files\Python311\python.exe
2024-02-05T11:10:27.6343924Z   PIP_OPTIONS: --user
2024-02-05T11:10:27.6344228Z ##[endgroup]
2024-02-05T11:10:27.8574062Z ##[group]Create virtualenv
2024-02-05T11:10:27.8574671Z Python that creates venv: C:\Program Files\Python311\python.exe
2024-02-05T11:10:27.8575659Z Creating virtual environment
2024-02-05T11:10:27.9637189Z E:\actions-runner-2\_work\_temp\240e3986-45ed-4749-991b-ba25eb19fba7.sh: line 5: C:\Program: No such file or directory
2024-02-05T11:10:28.0730635Z E:\actions-runner-2\_work\_temp\240e3986-45ed-4749-991b-ba25eb19fba7.sh: line 5: C:\Program: No such file or directory
2024-02-05T11:10:28.0738953Z Looks like there is neither virtualenv nor venv package installed
2024-02-05T11:10:28.1823611Z E:\actions-runner-2\_work\_temp\240e3986-45ed-4749-991b-ba25eb19fba7.sh: line 8: C:\Program: No such file or directory
2024-02-05T11:10:28.1833150Z Installing virtualenv package with PIP options '--user' failed, now trying without
2024-02-05T11:10:28.2762324Z E:\actions-runner-2\_work\_temp\240e3986-45ed-4749-991b-ba25eb19fba7.sh: line 11: C:\Program: No such file or directory
2024-02-05T11:10:28.2826640Z ##[error]Process completed with exit code 127.
2024-02-05T11:10:28.3969598Z ##[group]Run echo '##[group]Install Python dependencies'
2024-02-05T11:10:28.3970254Z echo '##[group]Install Python dependencies'
2024-02-05T11:10:28.3970967Z # make sure wheel is installed, which improves installing our dependencies
2024-02-05T11:10:28.3971657Z $PYTHON_VENV -m pip install wheel
2024-02-05T11:10:28.3972346Z $PYTHON_VENV -m pip install -r $GITHUB_ACTION_PATH/../python/requirements.txt
2024-02-05T11:10:28.3973035Z echo '##[endgroup]'
2024-02-05T11:10:28.4004106Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2024-02-05T11:10:28.4004789Z env:
<REDACTED>
2024-02-05T11:10:28.4007255Z   PYTHON_BIN: C:\Program Files\Python311\python.exe
2024-02-05T11:10:28.4007708Z ##[endgroup]
2024-02-05T11:10:28.6383882Z ##[group]Install Python dependencies
2024-02-05T11:10:28.7456674Z E:\actions-runner-2\_work\_temp\0541df69-fd06-4c0d-8c60-ad4b9d0f006c.sh: line 3: -m: command not found
2024-02-05T11:10:28.7516006Z ##[error]Process completed with exit code 127.
EnricoMi commented 8 months ago

What is the version of your Github runner? You can find that in the first line of the first job of any workflow:

Current runner version: '2.312.0'
simendsjo commented 8 months ago

What is the version of your Github runner? You can find that in the first line of the first job of any workflow:

Current runner version: '2.312.0'

Current runner version: '2.312.0'

But I think a co-worker found the issue and is writing a patch: https://github.com/EnricoMi/publish-unit-test-result-action/pull/558/files#diff-62bc08fbc7abfb39e85cda48d9dc73c6c02c5b268ea8ed14a89e40a441ad5b31R215

EnricoMi commented 8 months ago

Looks like this is caused by the space in $PYTHON_BIN: C:\Program Files\Python311\python.exe.

EnricoMi commented 8 months ago

Please try this fix:

uses: EnricoMi/publish-unit-test-result-action/composite@composite-quote-env-vars
simendsjo commented 8 months ago

Please try this fix:

uses: EnricoMi/publish-unit-test-result-action/composite@composite-quote-env-vars

Looks like you forgot to push it to github. I cannot find a branch or tag with that name.

EnricoMi commented 8 months ago

Already merged to master, so the branch is gone. You can test with

uses: EnricoMi/publish-unit-test-result-action/composite@master

or wait for the release in an hour.

simendsjo commented 8 months ago

Already merged to master, so the branch is gone. You can test with

uses: EnricoMi/publish-unit-test-result-action/composite@master

or wait for the release in an hour.

I have verified that @master works for us now.

simendsjo commented 8 months ago

or wait for the release in an hour.

Do you bump the v2 branch for these releases, or should I rely on the exact version for the fix?

EnricoMi commented 8 months ago

Released as v2. Should be picked up on the next run.