Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: DeezNET CodeQL config

# security-extended adds lower-precision security queries on top of the defaults
queries:
- uses: security-extended

# the library and CLI ship; tests don't
paths:
- DeezNET
- DeezCLI
paths-ignore:
- DeezNET.Tests
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,17 @@ updates:
schedule:
interval: weekly
open-pull-requests-limit: 5
groups:
# one PR for the test stack instead of one per package
test-dependencies:
patterns:
- "Microsoft.NET.Test.Sdk"
- "xunit*"
- "coverlet*"
- "Shouldly"

# also keeps the SHA-pinned actions current
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

# read-only; nothing in this workflow publishes
permissions:
contents: read

# a newer push to the same branch or PR makes the running build pointless
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
# same SDK as Lidarr.Plugin.Deezer, which builds this library from source
DOTNET_VERSION: 8.0.405

jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Pin the SDK
# the runner image has newer SDKs that would otherwise take precedence
# a block scalar, because the ": " inside the JSON would end a plain YAML value
run: |
echo '{"sdk":{"version": "${{ env.DOTNET_VERSION }}"}}' > ./global.json
- name: Restore
# NuGetAudit in DeezNET.csproj fails the restore on high or critical advisories, including transitive packages
run: dotnet restore DeezNET.sln
- name: Build
run: dotnet build DeezNET.sln -c Release --no-restore
- name: Test
# tests tagged Live call Deezer and compare against data that changes, so they aren't run here
run: dotnet test DeezNET.Tests -c Release --no-build --filter "Category!=Live" --logger "console;verbosity=normal"
- name: List vulnerable packages
# restore already fails on high and critical; this shows moderate and low ones in the log too
run: dotnet list DeezNET.sln package --vulnerable --include-transitive
56 changes: 56 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CodeQL
on:
push:
branches:
- main
pull_request:
schedule:
# weekly, so new queries run against unchanged code too
- cron: '23 6 * * 1'
workflow_dispatch:

permissions:
contents: read

jobs:
analyze:
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
languages: csharp
build-mode: none
config-file: ./.github/codeql/codeql-config.yml
- name: Analyze
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
category: /language:csharp

actions:
# scans the workflows themselves, for problems such as script injection from PR titles or overly broad tokens
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
languages: actions
build-mode: none
- name: Analyze
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
category: /language:actions
22 changes: 22 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dependency Review
on:
pull_request:

permissions:
contents: read
pull-requests: write

jobs:
dependency-review:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Review dependency changes
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
with:
# fail PRs that add a dependency with a known high or critical vulnerability
fail-on-severity: high
comment-summary-in-pr: on-failure
4 changes: 4 additions & 0 deletions DeezNET.Tests/DeezerURLTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public void TryParseFullUrlTest(string url, bool parsable, long id = 0, EntityTy


// i don't know if these short urls expire
// calls Deezer, so CI skips it with --filter "Category!=Live"
[Trait("Category", "Live")]
[Theory]
[InlineData("https://deezer.page.link/PjpK8Ywdavbpn9FA8", "https://www.deezer.com/track/29373181?host=3103984544&utm_campaign=clipboard-generic&utm_source=user_sharing&utm_content=track-29373181&deferredFl=1")]
[InlineData("https://deezer.page.link/27ms3uwmnFK63wsQ6", "https://www.deezer.com/album/548556802?host=3103984544&utm_campaign=clipboard-generic&utm_source=user_sharing&utm_content=album-548556802&deferredFl=1")]
Expand All @@ -57,6 +59,8 @@ public void UnshortenURLTest(string shortened, string expected)
}

// it's very possible for the Artist and ArtistTop values to change later
// calls Deezer, so CI skips it with --filter "Category!=Live"
[Trait("Category", "Live")]
[Theory]
[InlineData("https://www.deezer.com/en/track/13787884", new long[] { 13787884 })]
[InlineData("https://www.deezer.com/en/album/509603971", new long[] { 2531592621, 2531592631, 2531592641, 2531592651, 2531592661 })]
Expand Down