Skip to content

Commit

Permalink
Merge pull request #687 from maresb/collect-pytest-split-data-2
Browse files Browse the repository at this point in the history
Collect test duration data for various runner configurations
  • Loading branch information
maresb authored Sep 10, 2024
2 parents 8be069b + a0d1eaf commit 57f1906
Show file tree
Hide file tree
Showing 3 changed files with 366 additions and 290 deletions.
68 changes: 27 additions & 41 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,16 @@ env:
MICROMAMBA_VERSION: 'latest'

jobs:
test-windows:
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
runs-on: windows-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: ${{ env.MICROMAMBA_VERSION }}
environment-file: environments/dev-environment.yaml
init-shell: powershell
create-args: >-
python=3.12

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

- name: run-test
run: |
copy pyproject.toml "%RUNNER_TEMP%"
Xcopy /E /I tests "%RUNNER_TEMP%\\tests"
pushd "${RUNNER_TEMP}"
set TMPDIR="%RUNNER_TEMP%"
dir
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests
copy coverage.xml %GITHUB_WORKSPACE%
- uses: codecov/codecov-action@v4

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8", "3.12" ]
defaults:
run:
shell: bash -l {0}
shell: bash -eo pipefail -l {0}
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
Expand All @@ -70,27 +38,45 @@ jobs:
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: ${{ env.MICROMAMBA_VERSION }}
environment-file: environments/dev-environment.yaml
environment-file: environments/conda-lock.yml
environment-name: conda-lock-dev
init-shell: bash
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
python=${{ matrix.python-version }} --category=main --category=dev

- name: install conda-lock
shell: bash -eo pipefail -l {0}
run: |
which pip
pip install -e . --force-reinstall
pip install -e . --no-deps
pip check

- name: run-test
shell: bash -eo pipefail -l {0}
run: |
mkdir -p tests/durations
cp pyproject.toml "${RUNNER_TEMP}/"
cp -a tests "${RUNNER_TEMP}/"
pushd "${RUNNER_TEMP}"
export TMPDIR="${RUNNER_TEMP}"
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@v4

- name: Print test durations
run: |
ls -al tests/durations
cat tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json

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

0 comments on commit 57f1906

Please sign in to comment.