Skip to content

Commit

Permalink
[CI] Split pytest into groups (#5943)
Browse files Browse the repository at this point in the history
* Split pytest into 3 groups

* Combine coverage

* Add test durations
  • Loading branch information
fangeugene committed May 18, 2024
1 parent f265cdc commit 8ec615a
Show file tree
Hide file tree
Showing 5 changed files with 2,843 additions and 14 deletions.
52 changes: 40 additions & 12 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
python-version: "3.12"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -35,8 +35,8 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
python-version: "3.12"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -47,20 +47,48 @@ jobs:
py3-test:
name: "[py3] Test"
runs-on: ubuntu-latest
strategy:
matrix:
group: [1, 2, 3]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
python-version: "3.12"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r src/requirements.txt
- name: Run Tests
run: ./ops/test_py3.sh
run: ./ops/test_py3.sh --cov --splits 3 --group ${{ matrix.group }}
- name: Save coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage${{ matrix.group }}
path: .coverage
py3-coverage:
name: "[py3] Coverage"
runs-on: ubuntu-latest
needs: [py3-test]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Combine coverage
run: |
coverage combine coverage*/.coverage*
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.4.0
node-lint:
Expand Down Expand Up @@ -103,8 +131,8 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
python-version: "3.12"
cache: "pip"
- name: Install Shellcheck
run: |
python -m pip install --upgrade pip
Expand All @@ -126,7 +154,7 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: "3.12"
- name: Set up Node
uses: actions/setup-node@v4.0.2
with:
Expand All @@ -150,8 +178,8 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
python-version: "3.12"
cache: "pip"
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
Expand Down
32 changes: 31 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
py3-test:
name: "[py3] Test"
runs-on: ubuntu-latest
strategy:
matrix:
group: [1, 2, 3]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
Expand All @@ -64,7 +67,34 @@ jobs:
pip install -r src/requirements.txt
- name: Run Tests
if: contains(github.event.commits[0].message, '[clowntown]') == false
run: ./ops/test_py3.sh
run: ./ops/test_py3.sh --cov --splits 3 --group ${{ matrix.group }}
- name: Save coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage${{ matrix.group }}
path: .coverage
py3-coverage:
name: "[py3] Coverage"
runs-on: ubuntu-latest
needs: [py3-test]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install Dependencies
if: contains(github.event.commits[0].message, '[clowntown]') == false
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Combine coverage
if: contains(github.event.commits[0].message, '[clowntown]') == false
run: |
coverage combine coverage*/.coverage*
coverage xml
- name: Upload coverage to Codecov
if: contains(github.event.commits[0].message, '[clowntown]') == false
uses: codecov/codecov-action@v4.4.0
Expand Down

0 comments on commit 8ec615a

Please sign in to comment.