Skip to content

Commit

Permalink
chore: split workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
asai95 committed Dec 23, 2023
1 parent 587e2a4 commit df4fbcd
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 77 deletions.
80 changes: 3 additions & 77 deletions .github/workflows/deploy-to-pip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,85 +4,11 @@ on:
- v*

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ffmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
- name: Test with pytest
run: |
coverage run -m pytest tests
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: Store coverage files
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage

upload-coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage
- name: Download coverage files
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage
- name: Merge coverage files
run: |
coverage combine coverage
coverage xml -o coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with ruff
run: |
ruff check .
- name: Lint with mypy
run: |
mypy .
test-and-lint:
uses: ./.github/workflows/run-tests.yaml
deploy:
needs:
- test
- lint
- test-and-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
on:
push:
branches:
- master
workflow_call:


jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ffmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
- name: Test with pytest
run: |
coverage run -m pytest tests
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: Store coverage files
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage

upload-coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage
- name: Download coverage files
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage
- name: Merge coverage files
run: |
coverage combine coverage
coverage xml -o coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with ruff
run: |
ruff check .
- name: Lint with mypy
run: |
mypy .

0 comments on commit df4fbcd

Please sign in to comment.