Skip to content

Commit

Permalink
Merge branch 'main' into transcode
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-yantsen authored Mar 5, 2023
2 parents a582cab + 0c376c6 commit 2e5b4f2
Show file tree
Hide file tree
Showing 23 changed files with 156 additions and 233 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/lints-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,22 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
run: cargo check

lints_nightly:
name: Lints (nightly)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
profile: minimal
toolchain: nightly
override: true
components: "rustfmt, clippy"
components: "rustfmt,clippy"
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: "--all -- --check"
run: cargo fmt --all -- --check
- name: Clippy with warnings
uses: actions-rs/cargo@v1
with:
command: clippy
args: "--all-targets --all-features -- -D warnings"
run: cargo clippy --all-targets --all-features -- -D warnings
36 changes: 8 additions & 28 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@ jobs:
msrv=$(cat crates/plex-api/Cargo.toml | grep rust-version | sed 's/.* = "//; s/"//')
echo "msrv=$msrv" >> $GITHUB_OUTPUT
- name: Install the toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{steps.current_msrv.outputs.msrv}}
override: true
- uses: Swatinem/[email protected]
with:
shared-key: cache
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets
run: cargo check --workspace --all-targets
- name: Check the new MSRV
if: ${{ failure() }}
run: |
Expand All @@ -45,18 +40,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
run: cargo check

lints:
name: Lints
Expand All @@ -65,22 +54,13 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: "rustfmt, clippy"
components: "rustfmt,clippy"
- uses: Swatinem/[email protected]
with:
shared-key: cache
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: "--all -- --check"
run: cargo fmt --all -- --check
- name: Clippy with warnings
uses: actions-rs/cargo@v1
with:
command: clippy
args: "--all-targets --all-features -- -D warnings"
run: cargo clippy --all-targets --all-features -- -D warnings
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ jobs:
# a new release is created:
if: ${{ steps.release.outputs.release_created }}
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
if: ${{ steps.release.outputs.release_created }}
- run: cargo publish -p ${{ matrix.crate }}
env:
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/rust-clippy.yml

This file was deleted.

44 changes: 8 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: run
args: "--package xtask -- test --offline"
run: cargo run --package xtask -- test --offline

test_on_real_server_anonymous:
if: "!github.event.review"
Expand All @@ -52,19 +45,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache-anonymous
- name: "Test against real server [anonymous]"
uses: actions-rs/cargo@v1
with:
command: run
args: "--package xtask -- test --online --docker-tag '${{ matrix.plex_server_version }}' --deny-unknown-fields"
run: cargo run --package xtask -- test --online --docker-tag '${{ matrix.plex_server_version }}' --deny-unknown-fields

test_on_real_server_authenticated_free:
if: "(github.ref == 'refs/heads/main' && !github.event.review) || github.event.review.state == 'approved' || github.repository == github.event.pull_request.head.repo.full_name"
Expand All @@ -81,19 +67,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache-authenticated
- name: "Test against real server [authenticated]"
uses: actions-rs/cargo@v1
with:
command: run
args: "--package xtask -- test --online --docker-tag '${{ matrix.plex_server_version }}' --token '${{ secrets.PLEX_API_AUTH_TOKEN_FREE }}' --deny-unknown-fields"
run: cargo run --package xtask -- test --online --docker-tag '${{ matrix.plex_server_version }}' --token '${{ secrets.PLEX_API_AUTH_TOKEN_FREE }}' --deny-unknown-fields

test_on_real_server_authenticated_plexpass:
if: "(github.ref == 'refs/heads/main' && !github.event.review) || github.event.review.state == 'approved' || github.repository == github.event.pull_request.head.repo.full_name"
Expand All @@ -110,19 +89,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache-authenticated
- name: "Test against real server [authenticated]"
uses: actions-rs/cargo@v1
with:
command: run
args: "--package xtask -- test --online --docker-tag '${{ matrix.plex_server_version }}' --token '${{ secrets.PLEX_API_AUTH_TOKEN_PLEXPASS }}' --deny-unknown-fields"
run: cargo run --package xtask -- test --online --docker-tag '${{ matrix.plex_server_version }}' --token '${{ secrets.PLEX_API_AUTH_TOKEN_PLEXPASS }}' --deny-unknown-fields

collect_coverage:
if: "!github.event.review"
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/update_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache
Expand All @@ -26,10 +22,7 @@ jobs:
-H 'Accept: application/json' \
https://plex.tv/api/v2/features\?X-Plex-Product\=Plex%20Web\&X-Plex-Version\=4.77.3\&X-Plex-Client-Identifier\=${{ secrets.X_PLEX_CLIENT_IDENTIFIER_FREE }}\&X-Plex-Platform\=Safari\&X-Plex-Platform-Version\=15.4\&X-Plex-Sync-Version\=2\&X-Plex-Features\=external-media%2Cindirect-media\&X-Plex-Model\=hosted\&X-Plex-Device\=OSX\&X-Plex-Device-Name\=Safari\&X-Plex-Device-Screen-Resolution\=1440x772%2C1440x900\&X-Plex-Token\=${{ secrets.PLEX_API_AUTH_TOKEN_PLEXPASS }}\&X-Plex-Language\=en
- name: Build plex-api
uses: actions-rs/cargo@v1
with:
command: build
args: "--package plex-api"
run: cargo build --package plex-api
- name: Check if the enum was updated
run: |
if git diff --exit-code crates/plex-api/src/media_container/server/feature.rs
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/update_pms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/[email protected]
with:
shared-key: cache
- name: Build xtask
uses: actions-rs/cargo@v1
with:
command: build
args: "--package xtask"
run: cargo build --package xtask
- id: tags
run: |
tags=$(cargo run -q --package xtask -- get-last-plex-tags --skip-tag latest --skip-tag beta --skip-tag plexpass)
Expand All @@ -43,9 +36,9 @@ jobs:
sed -i 's/\(Test on a real server ([a-z ]*)\).* # supported-version-1/\1 (${{ steps.tags.outputs.last_tag }}) # supported-version-1/g' .github/mergify.yml
sed -i 's/\(Test on a real server ([a-z ]*)\).* # supported-version-2/\1 (${{ steps.tags.outputs.second_tag }}) # supported-version-2/g' .github/mergify.yml
sed -i 's/\(Test on a real server ([a-z ]*)\).* # supported-version-3/\1 (${{ steps.tags.outputs.first_tag }}) # supported-version-3/g' .github/mergify.yml
- name: Update modify-data command
- name: Update xtask/DOCKER_PLEX_IMAGE_TAG_MIN_SUPPORTED
run: |
sed -i 's/DEFAULT_TAG: &str = "[-a-z0-9.]*/DEFAULT_TAG: \&str = "${{ steps.tags.outputs.last_tag }}/g' crates/xtask/src/modify_data.rs
sed -i 's/DOCKER_PLEX_IMAGE_TAG_MIN_SUPPORTED: &str = "[-a-z0-9.]*/DOCKER_PLEX_IMAGE_TAG_MIN_SUPPORTED: \&str = "${{ steps.tags.outputs.last_tag }}/g' crates/xtask/src/get_last_plex_tags.rs
- name: Update the list in README.md
run: |
plex_tags="$(echo '${{ steps.tags.outputs.tags }}' | jq -r '.[] | "* \(.)"')"
Expand Down
1 change: 1 addition & 0 deletions crates/plex-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ sys-info = "^0.9"
monostate = "^0.1.2"
serde-aux = "^4.1.2"
enum_dispatch = "^0.3.8"
secrecy = { version = "^0.8", features = ["serde"] }

[build-dependencies]
serde = { version = "^1.0", features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions crates/plex-api/examples/get-token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ async fn main() {
let password = prompt_password("Password: ").unwrap();

let mut myplex_result = MyPlexBuilder::default()
.set_username_and_password(&username, &password)
.set_username_and_password(&username, password.clone())
.build()
.await;

if let Err(plex_api::Error::OtpRequired) = myplex_result {
let otp = prompt_password("OTP: ").unwrap();
myplex_result = MyPlexBuilder::default()
.set_username_and_password(&username, &password)
.set_otp(&otp)
.set_username_and_password(&username, password)
.set_otp(otp)
.build()
.await;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/plex-api/examples/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async fn main() {
let code = prompt_password("Code: ").unwrap();

MyPlexBuilder::default()
.set_token(&token)
.set_token(token)
.build()
.await
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion crates/plex-api/examples/signout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async fn main() {
let token = prompt_password("Token: ").unwrap();

MyPlexBuilder::default()
.set_token(&token)
.set_token(token)
.build()
.await
.unwrap()
Expand Down
Loading

0 comments on commit 2e5b4f2

Please sign in to comment.