Skip to content

Commit

Permalink
Merge pull request #691 from maresb/simplify-pytest-ci
Browse files Browse the repository at this point in the history
Simplify pytest GHA workflow
  • Loading branch information
maresb authored Sep 11, 2024
2 parents 01555e7 + c44f6bd commit 1473122
Show file tree
Hide file tree
Showing 7 changed files with 871 additions and 1,053 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
exclude:
- os: windows
python-version: "3.8"
- os: macos
python-version: "3.8"

# Prune the indices so that we only run the splits up to the group size
# defined below in "include". (This is ugly but effective.)
Expand Down Expand Up @@ -101,22 +103,15 @@ jobs:
- name: run-test
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 \
--store-durations \
--clean-durations \
--durations-path "${{ github.workspace }}/tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json" \
--durations-path "tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json" \
--splits="${{ matrix.pytest-split-group-size }}" \
--group="${{ matrix.pytest-split-group-index }}" \
tests
cp coverage.xml "${{ github.workspace }}"
--group="${{ matrix.pytest-split-group-index }}"
- uses: codecov/codecov-action@v4

Expand Down Expand Up @@ -147,11 +142,11 @@ jobs:
mkdir temp
find . -type f -name '*.json' | xargs -n1 basename | sort | uniq > temp/filenames.txt
cat temp/filenames.txt
- name: Aggregate test durations
- name: Aggregate test durations and sort by key (test name)
run: |
mkdir aggregated
while read -r filename; do
jq -s 'add' $(find . -type f -name "$filename") > "aggregated/$filename"
jq -s 'add | to_entries | sort_by(.key) | from_entries' $(find . -type f -name "$filename") > "aggregated/$filename"
done < temp/filenames.txt
- name: Upload aggregated test durations
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ addopts = [
"--ignore-glob=**/vendor_poetry/**",
"--ignore-glob=**/_vendor/**"
]
testpaths = ["tests", "conda_lock"]
flake8-max-line-length = 105
flake8-ignore = ["docs/* ALL", "conda_lock/_version.py ALL"]
filterwarnings = "ignore::DeprecationWarning"
Expand Down
424 changes: 216 additions & 208 deletions tests/durations/macos-py3.12.json

Large diffs are not rendered by default.

210 changes: 0 additions & 210 deletions tests/durations/macos-py3.8.json

This file was deleted.

424 changes: 216 additions & 208 deletions tests/durations/ubuntu-py3.12.json

Large diffs are not rendered by default.

424 changes: 216 additions & 208 deletions tests/durations/ubuntu-py3.8.json

Large diffs are not rendered by default.

424 changes: 216 additions & 208 deletions tests/durations/windows-py3.12.json

Large diffs are not rendered by default.

0 comments on commit 1473122

Please sign in to comment.