Collect test duration data for various runner configurations #1724
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
# Concurrency group that uses the workflow name and PR number if available | |
# or commit SHA as a fallback. If a new build is triggered under that | |
# concurrency group while a previous build is running it will be canceled. | |
# Repeated pushes to a PR will cancel all previous builds, while multiple | |
# merges to main will not cancel. | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
MICROMAMBA_VERSION: 'latest' | |
jobs: | |
test-windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-latest ] | |
python-version: ["3.12"] | |
env: | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
runs-on: ${{ matrix.os }} | |
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=${{ matrix.python-version }} | |
- name: install conda-lock | |
run: | | |
pip install pytest-split | |
pip install -e . --force-reinstall | |
- name: run-test | |
run: | | |
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 --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@v4 | |
- 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 | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
python-version: [ "3.8", "3.12" ] | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: ${{ env.MICROMAMBA_VERSION }} | |
environment-file: environments/dev-environment.yaml | |
init-shell: bash | |
create-args: >- | |
python=${{ matrix.python-version }} | |
- name: install conda-lock | |
shell: bash -eo pipefail -l {0} | |
run: | | |
which pip | |
pip install pytest-split | |
pip install -e . --force-reinstall | |
- name: run-test | |
shell: bash -eo pipefail -l {0} | |
run: | | |
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 --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 | |
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@v4 | |
with: | |
name: test-durations-${{ matrix.os }}-py${{ matrix.python-version }} | |
path: tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json |