Set TMPDIR to RUNNER_TEMP on CI
The upload artifact action can't collect artifacts from /tmp/ in the test
runners. So now that we are writing the screenshots that we want to collect
later to the pytest `tmp_path` location we need to make sure that lives
somewhere the later actions can find it.
Pytest uses `tempfile.gettempdir()` to find the temp dir, and that respects a
number of environment variables including `TMPDIR`. This commits sets TMPDIR
to RUNNER_TEMP in in our test runners to make pytest uses the temp dir that's
mounted into the action containers.
For the docker based runners I can use the `env` map, but for the ubuntu ones
it didn't let me expand `${{ runner.temp }}` in the end map under `step`, so
I'm writing it to the env file for the runner instead. It failed to parse the
action yaml and said:
> Unrecognized named-value: 'runner'. Located at position 1 within expression: runner.temp
For the user part of the `pytest-of-$user` directory, I looked at the new
screenshot related test summary lines to see what the user was called.
`runner` on the ubuntu containers and `user` in our docker containers. Pytest
maintains the "pytest-current" symlink to the latest temp folder.
This commit is contained in:
parent
cc85d61303
commit
914227ca1c
|
|
@ -27,6 +27,7 @@ jobs:
|
|||
PY_COLORS: "1"
|
||||
DOCKER: "${{ matrix.image }}"
|
||||
CI: true
|
||||
TMPDIR: "${{ runner.temp }}"
|
||||
volumes:
|
||||
# Hardcoded because we can't use ${{ runner.temp }} here apparently.
|
||||
- /home/runner/work/_temp/:/home/runner/work/_temp/
|
||||
|
|
@ -54,7 +55,7 @@ jobs:
|
|||
with:
|
||||
name: "end2end-screenshots-${{ steps.info.outputs.date }}-${{ steps.info.outputs.sha_short }}-${{ matrix.image }}"
|
||||
path: |
|
||||
${{ runner.temp }}/pytest-screenshots/*.png
|
||||
${{ runner.temp }}/pytest-of-user/pytest-current/pytest-screenshots/*.png
|
||||
if-no-files-found: ignore
|
||||
if: failure()
|
||||
irc:
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ jobs:
|
|||
DOCKER: "${{ matrix.image }}"
|
||||
CI: true
|
||||
PYTEST_ADDOPTS: "--color=yes"
|
||||
TMPDIR: "${{ runner.temp }}"
|
||||
volumes:
|
||||
# Hardcoded because we can't use ${{ runner.temp }} here apparently.
|
||||
- /home/runner/work/_temp/:/home/runner/work/_temp/
|
||||
|
|
@ -131,7 +132,7 @@ jobs:
|
|||
with:
|
||||
name: "end2end-screenshots-${{ steps.info.outputs.date }}-${{ steps.info.outputs.sha_short }}-${{ matrix.image }}"
|
||||
path: |
|
||||
${{ runner.temp }}/pytest-screenshots/*.png
|
||||
${{ runner.temp }}/pytest-of-user/pytest-current/pytest-screenshots/*.png
|
||||
if-no-files-found: ignore
|
||||
if: failure()
|
||||
|
||||
|
|
@ -237,6 +238,8 @@ jobs:
|
|||
- name: Upgrade 3rd party assets
|
||||
run: "tox exec -e ${{ matrix.testenv }} -- python scripts/dev/update_3rdparty.py --gh-token ${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "startsWith(matrix.os, 'windows-')"
|
||||
- name: "Set TMPDIR for pytest"
|
||||
run: 'echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"'
|
||||
- name: "Run ${{ matrix.testenv }}"
|
||||
run: "dbus-run-session -- tox -e ${{ matrix.testenv }} -- ${{ matrix.args }}"
|
||||
if: "startsWith(matrix.os, 'ubuntu-')"
|
||||
|
|
@ -263,7 +266,7 @@ jobs:
|
|||
with:
|
||||
name: "end2end-screenshots-${{ steps.info.outputs.date }}-${{ steps.info.outputs.sha_short }}-${{ matrix.testenv }}-${{ matrix.os }}"
|
||||
path: |
|
||||
${{ runner.temp }}/pytest-screenshots/*.png
|
||||
${{ runner.temp }}/pytest-of-runner/pytest-current/pytest-screenshots/*.png
|
||||
if-no-files-found: ignore
|
||||
if: failure()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue