Skip to content

Commit

Permalink
Restrict tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Oct 28, 2024
1 parent 312a80c commit 559adf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 259 deletions.
180 changes: 0 additions & 180 deletions .github/workflows/integration-test.yml

This file was deleted.

82 changes: 3 additions & 79 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,57 +28,22 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu, macos, windows ]
os: [ windows ]
python-version: [ "3.8", "3.12" ]

# pytest-split handles dividing the tests into n groups indexed 1...n.
# The tests are automatically split so that the expected duration of each
# group is roughly the same.
# See the "exclude" section below for pruning to the group sizes,
# and the "include" section for defining the group sizes.
pytest-split-group-index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
pytest-split-group-index: [1]

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.)
- os: ubuntu
pytest-split-group-index: 4
- os: ubuntu
pytest-split-group-index: 5
- os: ubuntu
pytest-split-group-index: 6
- os: ubuntu
pytest-split-group-index: 7
- os: ubuntu
pytest-split-group-index: 8
- os: ubuntu
pytest-split-group-index: 9
- os: ubuntu
pytest-split-group-index: 10
- os: macos
pytest-split-group-index: 4
- os: macos
pytest-split-group-index: 5
- os: macos
pytest-split-group-index: 6
- os: macos
pytest-split-group-index: 7
- os: macos
pytest-split-group-index: 8
- os: macos
pytest-split-group-index: 9
- os: macos
pytest-split-group-index: 10
include:
- os: ubuntu
pytest-split-group-size: 3
- os: macos
pytest-split-group-size: 3
- os: windows
pytest-split-group-size: 10

Expand Down Expand Up @@ -118,45 +83,4 @@ jobs:
--clean-durations \
--durations-path "tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json" \
--splits="${{ matrix.pytest-split-group-size }}" \
--group="${{ matrix.pytest-split-group-index }}"
- 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 }}-${{ matrix.pytest-split-group-index }}
path: tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json

aggregate-durations:
name: Aggregate test durations
runs-on: ubuntu-latest
needs: test
steps:
- name: Download test durations
uses: actions/download-artifact@v4
# All the artifacts are downloaded into various subdirectories.
# For each filename that occurs, we need to find all the files in the
# subdirectories with the same name, group those, and merge them.
- name: Construct the list of filenames to aggregate and write them to temp/filenames.txt
id: construct-filenames
run: |
mkdir temp
find . -type f -name '*.json' | xargs -n1 basename | sort | uniq > temp/filenames.txt
cat temp/filenames.txt
- name: Aggregate test durations and sort by key (test name)
run: |
mkdir aggregated
while read -r filename; do
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
with:
name: aggregated-test-durations
path: aggregated
--group="${{ matrix.pytest-split-group-index }}" tests/test_lookup_cache.py

0 comments on commit 559adf3

Please sign in to comment.