Skip to content

Commit df4fbcd

Browse files
committed
chore: split workflows
1 parent 587e2a4 commit df4fbcd

File tree

2 files changed

+85
-77
lines changed

2 files changed

+85
-77
lines changed

.github/workflows/deploy-to-pip.yaml

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,11 @@ on:
44
- v*
55

66
jobs:
7-
test:
8-
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
python-version: [ "3.9", "3.10", "3.11" ]
12-
steps:
13-
- uses: actions/checkout@v4
14-
- name: Set up Python
15-
uses: actions/setup-python@v4
16-
with:
17-
python-version: ${{ matrix.python-version }}
18-
- name: Install ffmpeg
19-
run: sudo apt-get update && sudo apt-get install -y ffmpeg
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip wheel
23-
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
24-
- name: Test with pytest
25-
run: |
26-
coverage run -m pytest tests
27-
env:
28-
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
29-
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
30-
- name: Store coverage files
31-
uses: actions/upload-artifact@v3
32-
with:
33-
name: coverage
34-
path: coverage
35-
36-
upload-coverage:
37-
needs: test
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@v4
41-
- name: Set up Python
42-
uses: actions/setup-python@v4
43-
with:
44-
python-version: '3.11'
45-
- name: Install dependencies
46-
run: |
47-
python -m pip install --upgrade pip
48-
pip install coverage
49-
- name: Download coverage files
50-
uses: actions/download-artifact@v3
51-
with:
52-
name: coverage
53-
path: coverage
54-
- name: Merge coverage files
55-
run: |
56-
coverage combine coverage
57-
coverage xml -o coverage.xml
58-
- name: Upload coverage reports to Codecov
59-
uses: codecov/codecov-action@v3
60-
env:
61-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
62-
63-
lint:
64-
runs-on: ubuntu-latest
65-
steps:
66-
- uses: actions/checkout@v4
67-
- name: Set up Python
68-
uses: actions/setup-python@v4
69-
with:
70-
python-version: '3.11'
71-
- name: Install dependencies
72-
run: |
73-
python -m pip install --upgrade pip
74-
pip install -r requirements.txt
75-
- name: Lint with ruff
76-
run: |
77-
ruff check .
78-
- name: Lint with mypy
79-
run: |
80-
mypy .
81-
7+
test-and-lint:
8+
uses: ./.github/workflows/run-tests.yaml
829
deploy:
8310
needs:
84-
- test
85-
- lint
11+
- test-and-lint
8612
runs-on: ubuntu-latest
8713
steps:
8814
- uses: actions/checkout@v4

.github/workflows/run-tests.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
workflow_call:
6+
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [ "3.9", "3.10", "3.11" ]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install ffmpeg
21+
run: sudo apt-get update && sudo apt-get install -y ffmpeg
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip wheel
25+
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
26+
- name: Test with pytest
27+
run: |
28+
coverage run -m pytest tests
29+
env:
30+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
31+
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
32+
- name: Store coverage files
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: coverage
36+
path: coverage
37+
38+
upload-coverage:
39+
needs: test
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Set up Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: '3.11'
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install coverage
51+
- name: Download coverage files
52+
uses: actions/download-artifact@v3
53+
with:
54+
name: coverage
55+
path: coverage
56+
- name: Merge coverage files
57+
run: |
58+
coverage combine coverage
59+
coverage xml -o coverage.xml
60+
- name: Upload coverage reports to Codecov
61+
uses: codecov/codecov-action@v3
62+
env:
63+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
64+
65+
lint:
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
- name: Set up Python
70+
uses: actions/setup-python@v4
71+
with:
72+
python-version: '3.11'
73+
- name: Install dependencies
74+
run: |
75+
python -m pip install --upgrade pip
76+
pip install -r requirements.txt
77+
- name: Lint with ruff
78+
run: |
79+
ruff check .
80+
- name: Lint with mypy
81+
run: |
82+
mypy .

0 commit comments

Comments
 (0)