integration actions
This commit is contained in:
parent
2417bec691
commit
c7b28d9aac
19 changed files with 117 additions and 12 deletions
47
.github/workflows/ci-windows.yaml
vendored
47
.github/workflows/ci-windows.yaml
vendored
|
|
@ -31,6 +31,53 @@ jobs:
|
||||||
python -m pip install -e .[test]
|
python -m pip install -e .[test]
|
||||||
python -m pytest --reruns 3 --reruns-delay 5 tests/unit
|
python -m pytest --reruns 3 --reruns-delay 5 tests/unit
|
||||||
|
|
||||||
|
test-integration:
|
||||||
|
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 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
|
||||||
|
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/integration --ignore tests/integration/prebuilt_presets
|
||||||
|
|
||||||
|
|
||||||
|
test-integration-prebuilt-presets:
|
||||||
|
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 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
|
||||||
|
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/integration/prebuilt_presets
|
||||||
|
|
||||||
test-soundcloud:
|
test-soundcloud:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
|
|
||||||
66
.github/workflows/ci.yaml
vendored
66
.github/workflows/ci.yaml
vendored
|
|
@ -52,6 +52,58 @@ jobs:
|
||||||
path: /opt/coverage/unit
|
path: /opt/coverage/unit
|
||||||
key: ${{github.sha}}-coverage-unit
|
key: ${{github.sha}}-coverage-unit
|
||||||
|
|
||||||
|
test-integration:
|
||||||
|
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 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/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/integration
|
||||||
|
key: ${{github.sha}}-coverage-integration
|
||||||
|
|
||||||
|
test-integration-prebuilt-presets:
|
||||||
|
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 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/integration/prebuilt_presets && coverage xml -o /opt/coverage/integration-prebuilt-presets/coverage.xml
|
||||||
|
|
||||||
|
- name: Save coverage
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /opt/coverage/integration-prebuilt-presets
|
||||||
|
key: ${{github.sha}}-coverage-integration-prebuilt-presets
|
||||||
|
|
||||||
test-soundcloud:
|
test-soundcloud:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -154,6 +206,8 @@ jobs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: [
|
needs: [
|
||||||
test-unit,
|
test-unit,
|
||||||
|
test-integration,
|
||||||
|
test-integration-prebuilt-presets,
|
||||||
test-soundcloud,
|
test-soundcloud,
|
||||||
test-bandcamp,
|
test-bandcamp,
|
||||||
test-youtube,
|
test-youtube,
|
||||||
|
|
@ -169,6 +223,18 @@ jobs:
|
||||||
path: /opt/coverage/unit
|
path: /opt/coverage/unit
|
||||||
key: ${{github.sha}}-coverage-unit
|
key: ${{github.sha}}-coverage-unit
|
||||||
|
|
||||||
|
- name: Restore integration test coverage
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /opt/coverage/unit
|
||||||
|
key: ${{github.sha}}-coverage-integration
|
||||||
|
|
||||||
|
- name: Restore integration prebuilt presets test coverage
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /opt/coverage/unit
|
||||||
|
key: ${{github.sha}}-coverage-integration-prebuilt-presets
|
||||||
|
|
||||||
- name: Restore soundcloud test coverage
|
- name: Restore soundcloud test coverage
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
from expected_transaction_log import assert_transaction_log_matches
|
from expected_transaction_log import assert_transaction_log_matches
|
||||||
from unit.conftest import mock_download_collection_entries
|
|
||||||
|
|
||||||
from ytdl_sub.subscriptions.subscription import Subscription
|
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
|
from ytdl_sub.utils.system import IS_WINDOWS
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
def test_working_directory_lock(default_config: ConfigFile):
|
||||||
def config() -> ConfigFile:
|
|
||||||
return ConfigFile(
|
|
||||||
name="config", value={"configuration": {"working_directory": "test"}, "presets": {}}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_working_directory_lock(config: ConfigFile):
|
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
return
|
return
|
||||||
|
|
||||||
new_pid = os.fork()
|
new_pid = os.fork()
|
||||||
if new_pid == 0: # is child
|
if new_pid == 0: # is child
|
||||||
with working_directory_lock(config=config):
|
with working_directory_lock(config=default_config):
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
return
|
return
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
with pytest.raises(ValidationException, match="Cannot run two instances of ytdl-sub"):
|
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(1)
|
||||||
|
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
with working_directory_lock(config=config):
|
with working_directory_lock(config=default_config):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue