[DEV] Separate integration actions (#1079)
This commit is contained in:
parent
648201ed9c
commit
a3f59d5420
20 changed files with 40 additions and 104 deletions
43
.github/workflows/ci-windows.yaml
vendored
43
.github/workflows/ci-windows.yaml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
python -m pip install -e .[test]
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/unit
|
||||
|
||||
test-soundcloud:
|
||||
test-integration:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -44,7 +44,7 @@ jobs:
|
|||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e soundcloud tests with coverage
|
||||
- name: Run integration tests with coverage
|
||||
run: |
|
||||
curl.exe -L -o ffmpeg.zip https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip
|
||||
tar -xf ffmpeg.zip
|
||||
|
|
@ -52,9 +52,10 @@ jobs:
|
|||
move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe"
|
||||
|
||||
python -m pip install -e .[test]
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/soundcloud
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/integration --ignore tests/integration/prebuilt_presets
|
||||
|
||||
test-bandcamp:
|
||||
|
||||
test-integration-prebuilt-presets:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -67,31 +68,7 @@ jobs:
|
|||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e soundcloud tests with coverage
|
||||
run: |
|
||||
curl.exe -L -o ffmpeg.zip https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip
|
||||
tar -xf ffmpeg.zip
|
||||
move "ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe" "ffmpeg.exe"
|
||||
move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe"
|
||||
|
||||
python -m pip install -e .[test]
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/bandcamp
|
||||
|
||||
|
||||
test-youtube:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e youtube tests with coverage
|
||||
- name: Run prebuilt preset integration tests with coverage
|
||||
run: |
|
||||
curl.exe -L -o ffmpeg.zip https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip
|
||||
tar -xf ffmpeg.zip
|
||||
|
|
@ -99,9 +76,9 @@ jobs:
|
|||
move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe"
|
||||
|
||||
python -m pip install -e .[test]
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/youtube
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/integration/prebuilt_presets
|
||||
|
||||
test-plugins:
|
||||
test-e2e:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -114,7 +91,7 @@ jobs:
|
|||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e plugin tests with coverage
|
||||
- name: Run e2e tests with coverage
|
||||
run: |
|
||||
curl.exe -L -o ffmpeg.zip https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip
|
||||
tar -xf ffmpeg.zip
|
||||
|
|
@ -122,4 +99,4 @@ jobs:
|
|||
move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe"
|
||||
|
||||
python -m pip install -e .[test]
|
||||
python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/plugins
|
||||
python -m pytest tests/e2e
|
||||
|
|
|
|||
85
.github/workflows/ci.yaml
vendored
85
.github/workflows/ci.yaml
vendored
|
|
@ -52,7 +52,7 @@ jobs:
|
|||
path: /opt/coverage/unit
|
||||
key: ${{github.sha}}-coverage-unit
|
||||
|
||||
test-soundcloud:
|
||||
test-integration:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -65,40 +65,20 @@ jobs:
|
|||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e soundcloud tests with coverage
|
||||
- name: Run integration tests with coverage
|
||||
run: |
|
||||
pip install -e .[test]
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ffmpeg
|
||||
coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/soundcloud && coverage xml -o /opt/coverage/soundcloud/coverage.xml
|
||||
|
||||
test-bandcamp:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e soundcloud tests with coverage
|
||||
run: |
|
||||
pip install -e .[test]
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ffmpeg
|
||||
coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/bandcamp && coverage xml -o /opt/coverage/bandcamp/coverage.xml
|
||||
coverage run -m pytest --reruns 3 --reruns-delay 5 tests/integration --ignore tests/integration/prebuilt_presets && coverage xml -o /opt/coverage/integration/coverage.xml
|
||||
|
||||
- name: Save coverage
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /opt/coverage/bandcamp
|
||||
key: ${{github.sha}}-coverage-bandcamp
|
||||
path: /opt/coverage/integration
|
||||
key: ${{github.sha}}-coverage-integration
|
||||
|
||||
test-youtube:
|
||||
test-integration-prebuilt-presets:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -111,20 +91,20 @@ jobs:
|
|||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e youtube tests with coverage
|
||||
- name: Run prebuilt preset integration tests with coverage
|
||||
run: |
|
||||
pip install -e .[test]
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ffmpeg
|
||||
coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/youtube && coverage xml -o /opt/coverage/youtube/coverage.xml
|
||||
coverage run -m pytest --reruns 3 --reruns-delay 5 tests/integration/prebuilt_presets && coverage xml -o /opt/coverage/integration-prebuilt-presets/coverage.xml
|
||||
|
||||
- name: Save coverage
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /opt/coverage/youtube
|
||||
key: ${{github.sha}}-coverage-youtube
|
||||
path: /opt/coverage/integration-prebuilt-presets
|
||||
key: ${{github.sha}}-coverage-integration-prebuilt-presets
|
||||
|
||||
test-plugins:
|
||||
test-e2e:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -137,27 +117,20 @@ jobs:
|
|||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Run e2e plugin tests with coverage
|
||||
- name: Run e2e tests with coverage
|
||||
run: |
|
||||
pip install -e .[test]
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ffmpeg
|
||||
coverage run -m pytest --reruns 3 --reruns-delay 5 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
|
||||
coverage run -m pytest tests/e2e && coverage xml -o /opt/coverage/e2e/coverage.xml
|
||||
|
||||
codecov-upload:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [
|
||||
test-unit,
|
||||
test-soundcloud,
|
||||
test-bandcamp,
|
||||
test-youtube,
|
||||
test-plugins
|
||||
test-integration,
|
||||
test-integration-prebuilt-presets,
|
||||
test-e2e
|
||||
]
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -169,32 +142,26 @@ jobs:
|
|||
path: /opt/coverage/unit
|
||||
key: ${{github.sha}}-coverage-unit
|
||||
|
||||
- name: Restore soundcloud test coverage
|
||||
- name: Restore integration test coverage
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /opt/coverage/soundcloud
|
||||
key: ${{github.sha}}-coverage-soundcloud
|
||||
path: /opt/coverage/integration
|
||||
key: ${{github.sha}}-coverage-integration
|
||||
|
||||
- name: Restore bandcamp test coverage
|
||||
- name: Restore integration prebuilt presets test coverage
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /opt/coverage/bandcamp
|
||||
key: ${{github.sha}}-coverage-bandcamp
|
||||
path: /opt/coverage/integration-prebuilt-presets
|
||||
key: ${{github.sha}}-coverage-integration-prebuilt-presets
|
||||
|
||||
- name: Restore youtube test coverage
|
||||
- name: Restore e2e 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
|
||||
path: /opt/coverage/e2e
|
||||
key: ${{github.sha}}-coverage-e2e
|
||||
|
||||
- name: Upload code coverage to codecov.io
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: /opt/coverage/unit/coverage.xml,/opt/coverage/soundcloud/coverage.xml,/opt/coverage/bandcamp/coverage.xml,/opt/coverage/youtube/coverage.xml,/opt/coverage/plugins/coverage.xml
|
||||
files: /opt/coverage/unit/coverage.xml,/opt/coverage/integration/coverage.xml,/opt/coverage/integration-prebuilt-presets/coverage.xml,/opt/coverage/e2e/coverage.xml
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import pytest
|
||||
from expected_transaction_log import assert_transaction_log_matches
|
||||
from unit.conftest import mock_download_collection_entries
|
||||
|
||||
from ytdl_sub.subscriptions.subscription import Subscription
|
||||
|
||||
0
tests/integration/prebuilt_presets/__init__.py
Normal file
0
tests/integration/prebuilt_presets/__init__.py
Normal file
|
|
@ -9,28 +9,21 @@ from ytdl_sub.utils.file_lock import working_directory_lock
|
|||
from ytdl_sub.utils.system import IS_WINDOWS
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config() -> ConfigFile:
|
||||
return ConfigFile(
|
||||
name="config", value={"configuration": {"working_directory": "test"}, "presets": {}}
|
||||
)
|
||||
|
||||
|
||||
def test_working_directory_lock(config: ConfigFile):
|
||||
def test_working_directory_lock(default_config: ConfigFile):
|
||||
if IS_WINDOWS:
|
||||
return
|
||||
|
||||
new_pid = os.fork()
|
||||
if new_pid == 0: # is child
|
||||
with working_directory_lock(config=config):
|
||||
with working_directory_lock(config=default_config):
|
||||
time.sleep(3)
|
||||
return
|
||||
|
||||
time.sleep(1)
|
||||
with pytest.raises(ValidationException, match="Cannot run two instances of ytdl-sub"):
|
||||
with working_directory_lock(config=config):
|
||||
with working_directory_lock(config=default_config):
|
||||
time.sleep(1)
|
||||
|
||||
time.sleep(3)
|
||||
with working_directory_lock(config=config):
|
||||
with working_directory_lock(config=default_config):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue