Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
ci(tests): bootstrap plex server
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Sep 11, 2023
1 parent 66215e8 commit 1f57428
Show file tree
Hide file tree
Showing 9 changed files with 1,030 additions and 63 deletions.
157 changes: 136 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,8 @@ jobs:
run: |
python ./scripts/build_plist.py
- name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v3
with:
name: Themerr-plex.bundle
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
path: |
${{ github.workspace }}
!**/*.git*
!**/*.pyc
!**/__pycache__
!**/plexhints*
!**/Themerr-plex.bundle/.*
!**/Themerr-plex.bundle/cache.sqlite
!**/Themerr-plex.bundle/DOCKER_README.md
!**/Themerr-plex.bundle/Dockerfile
!**/Themerr-plex.bundle/docs
!**/Themerr-plex.bundle/scripts
!**/Themerr-plex.bundle/tests
- name: Package Release
shell: bash
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
7z \
"-xr!*.git*" \
Expand All @@ -103,6 +82,7 @@ jobs:
"-xr!plexhints*" \
"-xr!Themerr-plex.bundle/.*" \
"-xr!Themerr-plex.bundle/cache.sqlite" \
"-xr!Themerr-plex.bundle/crowdin.yml" \
"-xr!Themerr-plex.bundle/DOCKER_README.md" \
"-xr!Themerr-plex.bundle/Dockerfile" \
"-xr!Themerr-plex.bundle/docs" \
Expand All @@ -113,6 +93,14 @@ jobs:
mkdir artifacts
mv ./Themerr-plex.bundle.zip ./artifacts/
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Themerr-plex.bundle
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
path: |
${{ github.workspace }}/artifacts
- name: Create Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: LizardByte/.github/actions/create_release@master
Expand All @@ -121,3 +109,130 @@ jobs:
next_version: ${{ needs.check_changelog.outputs.next_version }}
last_version: ${{ needs.check_changelog.outputs.last_version }}
release_body: ${{ needs.check_changelog.outputs.release_body }}

pytest:
needs: [build]
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}
env:
PLEXAPI_AUTH_SERVER_BASEURL: http://127.0.0.1:32400
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: Themerr-plex.bundle

- name: Extract artifacts zip
shell: bash
run: |
# extract zip
7z x Themerr-plex.bundle.zip -o.
# move all files from "Themerr-plex.bundle" to root, with no target directory
cp -r ./Themerr-plex.bundle/. .
# remove zip
rm Themerr-plex.bundle.zip
- name: Debug after extract
shell: bash
run: |
ls -a ./Contents
- name: Set up Python
uses: LizardByte/.github/actions/setup_python2@nightly

- name: Install python dependencies
shell: bash
run: |
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade \
pip setuptools wheel
python -m pip --no-python-version-warning --disable-pip-version-check install -r requirements-dev.txt
# python -m pip --no-python-version-warning --disable-pip-version-check install -r requirements.txt
- name: Install Plex Media Server
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
choco install plexmediaserver
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
brew install --cask plex-media-server
# starting with pms 1.29.2 servers must be claimed... disable that
# https://forums.plex.tv/t/new-server-claiming-requirement-for-macos/816337
defaults write com.plexapp.plexmediaserver enableLocalSecurity -bool FALSE
open "/Applications/Plex Media Server.app"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
echo deb https://downloads.plex.tv/repo/deb public main | \
sudo tee /etc/apt/sources.list.d/plexmediaserver.list
sudo apt-get update
sudo apt-get install plexmediaserver
# plex home directory
echo "Plex home directory: ${PLEX_HOME}"
# stop service
sudo systemctl stop plexmediaserver
# start server in the background
"/usr/lib/plexmediaserver/Plex Media Server" &
else
echo "Unknown OS: ${{ matrix.os }}"
exit 1
fi
- name: Update Plex registry settings
if: ${{ matrix.os == 'windows-latest' }}
run: |
# starting with pmps 1.32.2 servers must be claimed... disable that
# https://forums.plex.tv/t/new-claiming-requirement-for-windows/839096
REG ADD "HKCU\Software\Plex, Inc.\Plex Media Server" /v enableLocalSecurity /t REG_DWORD /d 0 /f
- name: Bootstrap Plex server
id: boostrap
uses: nick-fields/[email protected]
with:
max_attempts: 3
timeout_minutes: 3
shell: bash
command: |
#if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
# python \
# -u scripts/plex-bootstraptest.py \
# --destination plex \
# --advertise-ip 127.0.0.1 \
# --bootstrap-timeout 540 \
# --docker-tag latest \
# --without-shows \
# --without-music \
# --without-photos \
# --unclaimed
#else
python \
-u scripts/plex-bootstraptest.py \
--destination plex \
--advertise-ip 127.0.0.1 \
--bootstrap-timeout 540 \
--no-docker \
--server-name plex-test-${{ matrix.os }}-${{ github.run_id }} \
--without-shows \
--without-music \
--without-photos \
--unclaimed
#fi
# on_retry_command: |
# docker rm -f $(docker ps --latest)

- name: Test with pytest
shell: bash # our Python 2.7 setup action doesn't support PowerShell
run: |
python -m pytest -v
40 changes: 0 additions & 40 deletions .github/workflows/python-tests.yml

This file was deleted.

2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ flake8==3.9.2;python_version<"3"
m2r2==0.3.2;python_version<"3"
numpydoc==0.9.2;python_version<"3"
git+https://github.com/LizardByte/plexhints.git#egg=plexhints # type hinting library for plex development
plexapi-backport[alert]==4.15.1
pytest==4.6.11;python_version<"3"
rstcheck==3.5.0;python_version<"3"
Sphinx==1.8.6;python_version<"3"
sphinx-rtd-theme==1.2.0;python_version<"3"
tqdm==4.64.1;python_version<"3"
Loading

0 comments on commit 1f57428

Please sign in to comment.