Skip to content

Commit

Permalink
Use venv to test OS (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Apr 4, 2024
1 parent 30eadd5 commit 78c6824
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
38 changes: 21 additions & 17 deletions .github/actions/test/action.yml
Expand Up @@ -62,29 +62,33 @@ runs:
- name: Install Python dependencies
run: |
python3 -V
python -m venv "$RUNNER_TEMP/venv"
echo "$RUNNER_TEMP/venv/bin" >> "$GITHUB_PATH"
echo "$RUNNER_TEMP/venv/Scripts" >> "$GITHUB_PATH"
export PATH="$RUNNER_TEMP/venv/bin:$RUNNER_TEMP/venv/Scripts:$PATH"
which python
# inspect pip cache
python3 -m pip freeze | sort
python3 -m pip cache info || true
python3 -m pip cache list || true
python -m pip freeze | sort
python -m pip cache info || true
python -m pip cache list || true
# remove cached built whl files
rm -rf "$(python3 -m pip cache info | grep "Locally built wheels location: " | cut -d ":" -f 2- | cut -d " " -f 2-)"
python3 -m pip cache list || true
rm -rf "$(python -m pip cache info | grep ".*[Ww]heels location: " | cut -d ":" -f 2- | cut -d " " -f 2-)"
python -m pip cache list || true
# install dependencies
python_minor_version="$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
python3 -m pip install --force -r python/requirements-$python_minor_version.txt
python3 -m pip install --force -r python/test/requirements.txt -c python/test/constraints.txt
python_minor_version="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
python -m pip install --force -r python/requirements-$python_minor_version.txt
python -m pip install --force -r python/test/requirements.txt -c python/test/constraints.txt
# inspect pip cache
python3 -m pip freeze | sort
python3 -m pip cache info || true
python3 -m pip cache list || true
python -m pip freeze | sort
python -m pip cache info || true
python -m pip cache list || true
# assert no whl files have been built
if [ python3 -m pip cache info ] && [ "$(python3 -m pip cache info | grep "Number of locally built wheels:")" != "Number of locally built wheels: 0" ]
if python -m pip cache info && [[ "$(python -m pip cache info | grep "Number of .*wheels:")" != "Number of "*"wheels: 0" ]]
then
echo "Dependency whl files have been built"
exit 1
Expand Down Expand Up @@ -112,7 +116,7 @@ runs:
if: steps.changes.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: Changed expectations
name: Changed expectations (python-${{ inputs.python-version }}, ${{ inputs.os }})
path: changed-expectations.zip
if-no-files-found: error

Expand All @@ -121,7 +125,7 @@ runs:
PYTHONPATH: ..
run: |
cd python/test
python3 -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest.xml
python -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest.xml
shell: bash

- name: PyTest (EST)
Expand All @@ -131,7 +135,7 @@ runs:
PYTHONPATH: ..
run: |
cd python/test
python3 -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest-est.xml
python -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest-est.xml
shell: bash

- name: PyTest (CET)
Expand All @@ -141,7 +145,7 @@ runs:
PYTHONPATH: ..
run: |
cd python/test
python3 -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest-cet.xml
python -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest-cet.xml
shell: bash

- name: Upload Test Results
Expand Down
12 changes: 6 additions & 6 deletions python/test/files/update_expectations.sh
Expand Up @@ -2,9 +2,9 @@

base=$(dirname "$0")

python3 $base/../test_junit.py
python3 $base/../test_nunit.py
python3 $base/../test_xunit.py
python3 $base/../test_trx.py
python3 $base/../test_mocha.py
python3 $base/../test_dart.py
python $base/../test_junit.py
python $base/../test_nunit.py
python $base/../test_xunit.py
python $base/../test_trx.py
python $base/../test_mocha.py
python $base/../test_dart.py

0 comments on commit 78c6824

Please sign in to comment.