Skip to content

Commit

Permalink
Merge branch 'iv-org:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwmail authored Sep 14, 2024
2 parents d3e6d7b + 4782a67 commit c3b06e7
Show file tree
Hide file tree
Showing 183 changed files with 9,391 additions and 5,189 deletions.
75 changes: 28 additions & 47 deletions .ameba.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ Lint/ShadowingOuterLocalVar:
Excluded:
- src/invidious/helpers/tokens.cr

Lint/NotNil:
Enabled: false

Lint/SpecFilename:
Excluded:
- spec/parsers_helper.cr


#
# Style
Expand All @@ -31,6 +38,26 @@ Style/RedundantBegin:
Style/RedundantReturn:
Enabled: false

Style/ParenthesesAroundCondition:
Enabled: false

# This requires a rewrite of most data structs (and their usage) in Invidious.
Naming/QueryBoolMethods:
Enabled: false

Naming/AccessorMethodName:
Enabled: false

Naming/BlockParameterName:
Enabled: false

# Hides TODO comment warnings.
#
# Call `bin/ameba --only Documentation/DocumentationAdmonition` to
# list them
Documentation/DocumentationAdmonition:
Enabled: false


#
# Metrics
Expand All @@ -39,50 +66,4 @@ Style/RedundantReturn:
# Ignore function complexity (number of if/else & case/when branches)
# For some functions that can hardly be simplified for now
Metrics/CyclomaticComplexity:
Excluded:
# get_about_info(ucid, locale) => [17/10]
- src/invidious/channels/about.cr

# fetch_channel_community(ucid, continuation, ...) => [34/10]
- src/invidious/channels/community.cr

# create_notification_stream(env, topics, connection_channel) => [14/10]
- src/invidious/helpers/helpers.cr:84:5

# get_index(plural_form, count) => [25/10]
- src/invidious/helpers/i18next.cr

# call(context) => [18/10]
- src/invidious/helpers/static_file_handler.cr

# show(env) => [38/10]
- src/invidious/routes/embed.cr

# get_video_playback(env) => [45/10]
- src/invidious/routes/video_playback.cr

# handle(env) => [40/10]
- src/invidious/routes/watch.cr

# playlist_ajax(env) => [24/10]
- src/invidious/routes/playlists.cr

# fetch_youtube_comments(id, cursor, ....) => [40/10]
# template_youtube_comments(comments, locale, ...) => [16/10]
# content_to_comment_html(content) => [14/10]
- src/invidious/comments.cr

# to_json(locale, json) => [21/10]
# extract_video_info(video_id, ...) => [44/10]
# process_video_params(query, preferences) => [20/10]
- src/invidious/videos.cr



#src/invidious/playlists.cr:327:5
#[C] Metrics/CyclomaticComplexity: Cyclomatic complexity too high [19/10]
# fetch_playlist(plid : String)

#src/invidious/playlists.cr:436:5
#[C] Metrics/CyclomaticComplexity: Cyclomatic complexity too high [11/10]
# extract_playlist_videos(initial_data : Hash(String, JSON::Any))
Enabled: false
100 changes: 100 additions & 0 deletions .github/workflows/build-nightly-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build and release container directly from master

on:
push:
branches:
- "master"
paths-ignore:
- "*.md"
- LICENCE
- TRANSLATION
- invidious.service
- .git*
- .editorconfig
- screenshots/*
- .github/ISSUE_TEMPLATE/*
- kubernetes/**

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Crystal
uses: crystal-lang/[email protected]
with:
crystal: 1.12.2

- name: Run lint
run: |
if ! crystal tool format --check; then
crystal tool format
git diff
exit 1
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: quay.io/invidious/invidious
tags: |
type=sha,format=short,prefix={{date 'YYYY.MM.DD'}}-,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=raw,value=master,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
labels: |
quay.expires-after=12w
- name: Build and push Docker AMD64 image for Push Event
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
"release=1"
- name: Docker meta
id: meta-arm64
uses: docker/metadata-action@v5
with:
images: quay.io/invidious/invidious
flavor: |
suffix=-arm64
tags: |
type=sha,format=short,prefix={{date 'YYYY.MM.DD'}}-,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=raw,value=master,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
labels: |
quay.expires-after=12w
- name: Build and push Docker ARM64 image for Push Event
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.arm64
platforms: linux/arm64/v8
labels: ${{ steps.meta-arm64.outputs.labels }}
push: true
tags: ${{ steps.meta-arm64.outputs.tags }}
build-args: |
"release=1"
94 changes: 94 additions & 0 deletions .github/workflows/build-stable-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build and release container

on:
workflow_dispatch:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Crystal
uses: crystal-lang/[email protected]
with:
crystal: 1.12.2

- name: Run lint
run: |
if ! crystal tool format --check; then
crystal tool format
git diff
exit 1
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: quay.io/invidious/invidious
flavor: |
latest=false
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
labels: |
quay.expires-after=12w
- name: Build and push Docker AMD64 image for Push Event
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
"release=1"
- name: Docker meta
id: meta-arm64
uses: docker/metadata-action@v5
with:
images: quay.io/invidious/invidious
flavor: |
latest=false
suffix=-arm64
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
labels: |
quay.expires-after=12w
- name: Build and push Docker ARM64 image for Push Event
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.arm64
platforms: linux/arm64/v8
labels: ${{ steps.meta-arm64.outputs.labels }}
push: true
tags: ${{ steps.meta-arm64.outputs.tags }}
build-args: |
"release=1"
51 changes: 37 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,21 @@ jobs:
matrix:
stable: [true]
crystal:
- 1.4.1
- 1.5.1
- 1.6.2
- 1.7.3
- 1.8.1
- 1.9.2
- 1.10.1
- 1.11.2
- 1.12.1
include:
- crystal: nightly
stable: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Install Crystal
uses: crystal-lang/install-crystal@v1.7.0
uses: crystal-lang/install-crystal@v1.8.0
with:
crystal: ${{ matrix.crystal }}

Expand Down Expand Up @@ -88,13 +87,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build Docker
run: docker-compose build --build-arg release=0
run: docker compose build --build-arg release=0

- name: Run Docker
run: docker-compose up -d
run: docker compose up -d

- name: Test Docker
run: while curl -Isf http://localhost:3000; do sleep 1; done
Expand All @@ -104,18 +103,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build Docker ARM64 image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.arm64
Expand All @@ -125,4 +124,28 @@ jobs:
- name: Test Docker
run: while curl -Isf http://localhost:3000; do sleep 1; done

ameba_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Install Crystal
uses: crystal-lang/[email protected]
with:
crystal: latest

- name: Cache Shards
uses: actions/cache@v3
with:
path: |
./lib
./bin
key: shards-${{ hashFiles('shard.lock') }}

- name: Install Shards
run: shards install

- name: Run Ameba linter
run: bin/ameba
Loading

0 comments on commit c3b06e7

Please sign in to comment.