Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Debugging] Collect test duration data for various runner configurations #372

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
65 changes: 59 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ concurrency:

jobs:
test-windows:
strategy:
fail-fast: false
matrix:
os: [ windows-latest ]
python-version: ["3.10"]
# pytest-split-group: [1, 2, 3, 4, 5]
# pytest-split-groups: [5]
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
runs-on: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand All @@ -34,33 +41,67 @@ jobs:
- name: Install dev deps
run: |
conda activate test
mamba install pip pytest-cov pytest-xdist
mamba install pip pytest-cov pytest-xdist pytest-split
python -m pip install -r requirements-dev.txt

- name: install conda-lock
run: |
conda activate test
pip install -e . --force-reinstall

- name: Test storing test durations
uses: actions/upload-artifact@v3
with:
name: test-durations-test
path: tests\durations\.gitignore

- name: run-test
run: |
conda activate test
echo "%RUNNER_TEMP%"
echo %RUNNER_TEMP%
echo "%RUNNER_TEMP%\\tests"
echo %GITHUB_WORKSPACE%
echo ${{ github.workspace }}
dir "${{ github.workspace }}\tests\durations"
echo copy pyproject.toml
copy pyproject.toml "%RUNNER_TEMP%"
echo copy tests
Xcopy /E /I tests "%RUNNER_TEMP%\\tests"
echo pushd
pushd "${RUNNER_TEMP}"
echo set TMPDIR
set TMPDIR="%RUNNER_TEMP%"
dir
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --store-durations --durations-path "${{ github.workspace }}\tests\durations\${{ matrix.os }}-py${{ matrix.python-version }}.json" tests
copy coverage.xml %GITHUB_WORKSPACE%
- uses: codecov/codecov-action@v3

- name: Store test durations
uses: actions/upload-artifact@v3
with:
name: test-durations
path: tests\durations\${{ matrix.os }}-py${{ matrix.python-version }}.json

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
python-version: [ "3.8", "3.11" ]
# pytest-split-group: [1, 2, 3]
# pytest-split-groups: [2, 3]
# exclude:
# - os: ubuntu-latest
# # Force pytest-split-groups to 2 by excluding 3
# pytest-split-groups: 3
# - os: macos-latest
# # Force pytest-split-groups to 3 by excluding 2
# pytest-split-groups: 2
# - os: ubuntu-latest
# # Don't run the third group on ubuntu
# pytest-split-group: 3
defaults:
run:
shell: bash -l {0}
Expand All @@ -81,7 +122,7 @@ jobs:
- name: Install dev deps
run: |
conda activate test
mamba install pip pytest-cov pytest-xdist
mamba install pip pytest-cov pytest-xdist pytest-split
set -x
echo "${PATH}"
which pip
Expand All @@ -106,10 +147,22 @@ jobs:
ls -lah
set -x
which pytest
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests
cp coverage.xml "${GITHUB_WORKSPACE}"
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term --store-durations --durations-path "${{ github.workspace }}/tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json" tests
cp coverage.xml "${{ github.workspace }}"
- uses: codecov/codecov-action@v3

- name: print test durations
shell: bash -l {0}
run: |
ls -al tests/durations
cat tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json

- name: Store test durations
uses: actions/upload-artifact@v3
with:
name: test-durations
path: tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json

- name: test-gdal
shell: bash -l {0}
run: |
Expand Down
Empty file added tests/durations/.gitignore
Empty file.