Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate dependency PRs #2063

Merged
merged 5 commits into from
Nov 28, 2024
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
27 changes: 27 additions & 0 deletions .github/workflows/_build-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: build-dev

on:
workflow_call:

jobs:
dev:
# prevent job from running twice when a PR pushes a new commit
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "lts/*"
cache: "npm"
- name: NPM install
run: npm ci
- name: Install roku module dependencies
run: npm run ropm
- name: Build app
run: npm run build
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: Jellyfin-Roku-dev-${{ github.sha }}
path: ${{ github.workspace }}/build/staging
if-no-files-found: error
27 changes: 27 additions & 0 deletions .github/workflows/_build-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Builds the production version of the app
name: build-prod

on:
workflow_call:

jobs:
prod:
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'release-prep') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "lts/*"
cache: "npm"
- name: NPM install
run: npm ci
- name: Install roku module dependencies
run: npm run ropm
- name: Build app for production
run: npm run build-prod
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }}
path: ${{ github.workspace }}/build/staging
if-no-files-found: error
18 changes: 18 additions & 0 deletions .github/workflows/_lint-brightscript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: lint-brightscript

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- run: npm ci
- run: npx ropm install
- run: npm run validate
- run: npm run check-formatting
21 changes: 21 additions & 0 deletions .github/workflows/_lint-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint-json

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Install roku package dependencies
run: npx ropm install
- name: Validate JSON syntax
run: npm run lint-json
22 changes: 22 additions & 0 deletions .github/workflows/_lint-markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint-markdown

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Install roku package dependencies
run: npx ropm install
- uses: xt0rted/markdownlint-problem-matcher@1a5fabfb577370cfdf5af944d418e4be3ea06f27 # v3
- name: Lint markdown files
run: npm run lint-markdown
21 changes: 21 additions & 0 deletions .github/workflows/_lint-spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint-spelling

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Install roku package dependencies
run: npx ropm install
- name: Check markdown files for spelling errors
run: npm run lint-spelling
24 changes: 24 additions & 0 deletions .github/workflows/_lint-translation-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: lint-translation-files

on:
workflow_call:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- name: Install xmllint and xmlstarlet using apt (from cache)
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libxml2-utils xmlstarlet
- name: Validate XML syntax
run: xmllint --noout ./locale/en_US/translations.ts
- name: Save output of duplicate check
run: echo "tsDuplicates=$(xmlstarlet sel -t -m '/TS/context/message/source' -c '.' -nl ./locale/en_US/translations.ts | sort | uniq -d | awk '{ printf "%s", $0 }')" >> $GITHUB_ENV
- name: Check for duplicates
run: xmlstarlet sel -t -m '/TS/context/message/source' -f -o ' ' -c '.' -nl ./locale/en_US/translations.ts | sort | uniq -d
- name: Duplicates found
if: env.tsDuplicates != ''
run: exit 1
40 changes: 40 additions & 0 deletions .github/workflows/_roku-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: roku-analysis

on:
workflow_call:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
static:
# don't run job on forks and prevent job from running twice when a PR pushes a new commit
if: github.repository == 'jellyfin/jellyfin-roku' && github.event_name != 'pull_request' || github.repository == 'jellyfin/jellyfin-roku' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "lts/*"
cache: "npm"
- name: NPM install
run: npm ci
- name: Install roku module dependencies
run: npm run ropm
- name: Build dev app
if: env.BRANCH_NAME != 'master'
run: npm run build
- name: Build app for production
if: env.BRANCH_NAME == 'master'
run: npm run build-prod
- name: Setup Java
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: "temurin"
java-version: "21"
- name: Download the Static Channel Analysis CLI
run: |
curl -sSL "https://devtools.web.roku.com/static-channel-analysis/sca-cmd.zip" -o sca-cmd.zip
unzip sca-cmd.zip
- name: Run Roku Static Analysis
run: ./sca-cmd/bin/sca-cmd ${{ github.workspace }}/build/staging --exit error
23 changes: 23 additions & 0 deletions .github/workflows/_validate-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: validate-dependencies

on:
workflow_call:

jobs:
lint-brightscript:
uses: ./.github/workflows/_lint-brightscript.yml
lint-json:
uses: ./.github/workflows/_lint-json.yml
lint-markdown:
uses: ./.github/workflows/_lint-markdown.yml
lint-spelling:
uses: ./.github/workflows/_lint-spelling.yml
lint-translation-files:
uses: ./.github/workflows/_lint-translation-files.yml
build-dev:
uses: ./.github/workflows/_build-dev.yml
build-prod:
uses: ./.github/workflows/_build-prod.yml
roku-analysis:
uses: ./.github/workflows/_roku-analysis.yml

21 changes: 1 addition & 20 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,4 @@ on:

jobs:
dev:
# prevent job from running twice when a PR pushes a new commit
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "lts/*"
cache: "npm"
- name: NPM install
run: npm ci
- name: Install roku module dependencies
run: npm run ropm
- name: Build app
run: npm run build
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: Jellyfin-Roku-dev-${{ github.sha }}
path: ${{ github.workspace }}/build/staging
if-no-files-found: error
uses: ./.github/workflows/_build-dev.yml
20 changes: 1 addition & 19 deletions .github/workflows/build-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,4 @@ on:

jobs:
prod:
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'release-prep') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "lts/*"
cache: "npm"
- name: NPM install
run: npm ci
- name: Install roku module dependencies
run: npm run ropm
- name: Build app for production
run: npm run build-prod
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }}
path: ${{ github.workspace }}/build/staging
if-no-files-found: error
uses: ./.github/workflows/_build-prod.yml
10 changes: 10 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: dependencies

on:
pull_request:
types: [labeled, opened, synchronize, reopened]

jobs:
validate:
if: contains(github.event.pull_request.labels.*.name, 'dependencies')
uses: ./.github/workflows/_validate-dependencies.yml
12 changes: 1 addition & 11 deletions .github/workflows/lint-brightscript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,4 @@ on:

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- run: npm ci
- run: npx ropm install
- run: npm run validate
- run: npm run check-formatting
uses: ./.github/workflows/_lint-brightscript.yml
15 changes: 1 addition & 14 deletions .github/workflows/lint-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,4 @@ on:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Install roku package dependencies
run: npx ropm install
- name: Validate JSON syntax
run: npm run lint-json
uses: ./.github/workflows/_lint-json.yml
16 changes: 1 addition & 15 deletions .github/workflows/lint-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,4 @@ on:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Install roku package dependencies
run: npx ropm install
- uses: xt0rted/markdownlint-problem-matcher@1a5fabfb577370cfdf5af944d418e4be3ea06f27 # v3
- name: Lint markdown files
run: npm run lint-markdown
uses: ./.github/workflows/_lint-markdown.yml
15 changes: 1 addition & 14 deletions .github/workflows/lint-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,4 @@ on:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "lts/*"
cache: "npm"
- name: Install npm dependencies
run: npm ci
- name: Install roku package dependencies
run: npx ropm install
- name: Check markdown files for spelling errors
run: npm run lint-spelling
uses: ./.github/workflows/_lint-spelling.yml
18 changes: 1 addition & 17 deletions .github/workflows/lint-translation-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,4 @@ on:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Clone github repo
uses: actions/checkout@master
- name: Install xmllint and xmlstarlet using apt (from cache)
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libxml2-utils xmlstarlet
- name: Validate XML syntax
run: xmllint --noout ./locale/en_US/translations.ts
- name: Save output of duplicate check
run: echo "tsDuplicates=$(xmlstarlet sel -t -m '/TS/context/message/source' -c '.' -nl ./locale/en_US/translations.ts | sort | uniq -d | awk '{ printf "%s", $0 }')" >> $GITHUB_ENV
- name: Check for duplicates
run: xmlstarlet sel -t -m '/TS/context/message/source' -f -o ' ' -c '.' -nl ./locale/en_US/translations.ts | sort | uniq -d
- name: Duplicates found
if: env.tsDuplicates != ''
run: exit 1
uses: ./.github/workflows/_lint-translation-files.yml
Loading
Loading