This commit is contained in:
Jesse Bannon 2022-09-26 10:41:42 -07:00
parent 4d61a3d279
commit dad04ce170

View file

@ -23,7 +23,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get install -y --download-only ffmpeg apt-get install -y --download-only ffmpeg
python -m venv /opt/env python -m venv /opt/env
source /opt/env/bin/activate source /opt/env/bin/activate
pip install -e .[lint,test] pip install -e .[lint,test]
@ -40,9 +40,7 @@ jobs:
test-lint: test-lint:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [ needs: test-build
test-build
]
permissions: permissions:
contents: read contents: read
@ -62,9 +60,7 @@ jobs:
test-unit: test-unit:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [ needs: test-build
test-lint
]
permissions: permissions:
contents: read contents: read
@ -80,17 +76,23 @@ jobs:
- name: Run unit tests with coverage - name: Run unit tests with coverage
run: | run: |
source /opt/env/bin/activate source /opt/env/bin/activate
coverage run -m pytest tests/unit && coverage xml -o coverage-unit.xml coverage run -m pytest tests/unit && coverage xml -o /opt/coverage/unit/coverage.xml
- name: Save coverage
uses: actions/cache@v3
with:
path: /opt/coverage/unit
key: ${{github.sha}}-coverage-unit
test-soundcloud: test-soundcloud:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [ needs: test-build
test-lint
]
permissions: permissions:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v3
- name: Restore Python build cache - name: Restore Python build cache
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -107,33 +109,79 @@ jobs:
run: | run: |
sudo apt-get install -y ffmpeg sudo apt-get install -y ffmpeg
source /opt/env/bin/activate source /opt/env/bin/activate
coverage run -m pytest tests/e2e/soundcloud && coverage xml -o coverage-soundcloud.xml coverage run -m pytest tests/e2e/soundcloud && coverage xml -o /opt/coverage/soundcloud/coverage.xml
- name: Save coverage
uses: actions/cache@v3
with:
path: /opt/coverage/soundcloud
key: ${{github.sha}}-coverage-soundcloud
test-youtube: test-youtube:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [ needs: test-build
test-lint
]
permissions: permissions:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v3
- name: Restore Python build cache
uses: actions/cache@v3
with:
path: /opt/env
key: ${{github.sha}}-env
- name: Restore ffmpeg cache
uses: actions/cache@v3
with:
path: /var/cache/apt/archives
key: ${{github.sha}}-ffmpeg
- name: Run e2e youtube tests with coverage - name: Run e2e youtube tests with coverage
run: | run: |
coverage run -m pytest tests/e2e/youtube && coverage xml -o coverage-youtube.xml sudo apt-get install -y ffmpeg
source /opt/env/bin/activate
coverage run -m pytest tests/e2e/youtube && coverage xml -o /opt/coverage/youtube/coverage.xml
- name: Save coverage
uses: actions/cache@v3
with:
path: /opt/coverage/youtube
key: ${{github.sha}}-coverage-youtube
test-plugins: test-plugins:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [ needs: test-build
test-lint
]
permissions: permissions:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v3
- name: Restore Python build cache
uses: actions/cache@v3
with:
path: /opt/env
key: ${{github.sha}}-env
- name: Restore ffmpeg cache
uses: actions/cache@v3
with:
path: /var/cache/apt/archives
key: ${{github.sha}}-ffmpeg
- name: Run e2e plugin tests with coverage - name: Run e2e plugin tests with coverage
run: | run: |
coverage run -m pytest tests/e2e/plugins && coverage xml -o coverage-plugins.xml sudo apt-get install -y ffmpeg
source /opt/env/bin/activate
coverage run -m pytest tests/e2e/plugins && coverage xml -o /opt/coverage/plugins/coverage.xml
- name: Save coverage
uses: actions/cache@v3
with:
path: /opt/coverage/plugins
key: ${{github.sha}}-coverage-plugins
codecov-upload: codecov-upload:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
@ -147,7 +195,31 @@ jobs:
contents: read contents: read
steps: steps:
- name: Restore unit test coverage
uses: actions/cache@v3
with:
path: /opt/coverage/unit
key: ${{github.sha}}-coverage-unit
- name: Restore soundcloud test coverage
uses: actions/cache@v3
with:
path: /opt/coverage/soundcloud
key: ${{github.sha}}-coverage-soundcloud
- name: Restore youtube test coverage
uses: actions/cache@v3
with:
path: /opt/coverage/youtube
key: ${{github.sha}}-coverage-youtube
- name: Restore plugins test coverage
uses: actions/cache@v3
with:
path: /opt/coverage/plugins
key: ${{github.sha}}-coverage-plugins
- name: Upload code coverage to codecov.io - name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
with: with:
files: ./coverage-unit.xml,./coverage-soundcloud.xml,./coverage-youtube.xml,./coverage-plugins.xml files: /opt/coverage/unit/coverage.xml,/opt/coverage/soundcloud/coverage.xml,/opt/coverage/youtube/coverage.xml,/opt/coverage/plugins/coverage.xml