act_runner succeeds omg
This commit is contained in:
parent
4225bbdf61
commit
deb5ef397e
@ -26,7 +26,7 @@ jobs:
|
||||
# - name: Unit test all packages
|
||||
# run: pnpm test -r
|
||||
|
||||
test:
|
||||
test_phoenix:
|
||||
name: Tests & Checks
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 600
|
||||
@ -48,6 +48,7 @@ jobs:
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
PUBLIC_S3_ENDPOINT: ${{ secrets.PUBLIC_S3_ENDPOINT }}
|
||||
SITE_URL: https://futureporn.net
|
||||
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
|
||||
|
||||
# @blocking @see https://gitea.com/gitea/act_runner/issues/506
|
||||
services:
|
||||
@ -140,3 +141,11 @@ jobs:
|
||||
run: |
|
||||
mix coveralls
|
||||
working-directory: ./apps/bright
|
||||
|
||||
- name: Check for banned HTML elements (i.e. <a>)
|
||||
run: |
|
||||
if grep -R '</a>' ./lib; then
|
||||
echo "Found banned element '<a>' inside ./lib. Please use <.link> instead."
|
||||
exit 1
|
||||
fi
|
||||
working-directory: ./apps/bright
|
||||
|
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
@ -1,7 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"helm-ls.helm-ls",
|
||||
"tchoupinax.tilt",
|
||||
"redhat.vscode-yaml",
|
||||
"elixir-lsp.elixir-ls"
|
||||
]
|
||||
|
@ -171,7 +171,7 @@ defmodule Bright.Streams do
|
||||
def list_vods do
|
||||
Vod
|
||||
|> Repo.all()
|
||||
|> Repo.preload(:torrent)
|
||||
|> Repo.preload([:torrent, :stream])
|
||||
end
|
||||
|
||||
@doc """
|
||||
@ -201,7 +201,7 @@ defmodule Bright.Streams do
|
||||
def get_vod!(id) do
|
||||
Vod
|
||||
|> Repo.get!(id)
|
||||
|> Repo.preload(:torrent)
|
||||
|> Repo.preload([:torrent, :stream])
|
||||
end
|
||||
|
||||
@doc """
|
||||
@ -222,7 +222,7 @@ defmodule Bright.Streams do
|
||||
|> Repo.insert()
|
||||
|> case do
|
||||
{:ok, %Vod{} = vod} ->
|
||||
vod = Repo.preload(vod, [:torrent])
|
||||
vod = Repo.preload(vod, [:torrent, :stream])
|
||||
Oban.insert!(Bright.ObanWorkers.ProcessVod.new(%{vod_id: vod.id}))
|
||||
{:ok, vod}
|
||||
|
||||
@ -265,6 +265,7 @@ defmodule Bright.Streams do
|
||||
"""
|
||||
def update_vod(%Vod{} = vod, attrs) do
|
||||
vod
|
||||
|> Repo.preload([:stream, :torrent])
|
||||
|> Vod.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
@ -105,7 +105,7 @@ defmodule Bright.Torrentfile do
|
||||
meta_version
|
||||
) do
|
||||
Logger.debug(
|
||||
"Torrentfile.create called with args input_path=#{input_path}, output_path=#{output_path}, tracker_url=#{tracker_url}, source_url=#{source_url}, comment=#{comment}, web_seed_url=#{web_seed_url}, meta_version=#{meta_version}"
|
||||
"Torrentfile.create (torrentfile_path()=#{inspect(torrentfile_path())}) called with args input_path=#{input_path}, output_path=#{output_path}, tracker_url=#{tracker_url}, source_url=#{source_url}, comment=#{comment}, web_seed_url=#{web_seed_url}, meta_version=#{meta_version}"
|
||||
)
|
||||
|
||||
case Rambo.run(torrentfile_path(), [
|
||||
@ -127,7 +127,7 @@ defmodule Bright.Torrentfile do
|
||||
input_path
|
||||
]) do
|
||||
{:error, reason} -> {:error, reason}
|
||||
{:ok, %Rambo{status: 0, out: out, err: ""}} -> {:ok, parse_output(out)}
|
||||
{:ok, %Rambo{status: 0, out: out}} -> {:ok, parse_output(out)}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
defmodule Bright.Repo.Migrations.UndoAddPlatformIdToStream do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
# Remove the "Unknown" platform
|
||||
execute("DELETE FROM platforms WHERE id = 1")
|
||||
end
|
||||
end
|
@ -8,7 +8,7 @@ defmodule Bright.PlatformsTest do
|
||||
|
||||
import Bright.PlatformsFixtures
|
||||
|
||||
@invalid_attrs %{name: nil, url: nil, icon: nil}
|
||||
@invalid_attrs %{name: 7, url: 7, icon: 7}
|
||||
|
||||
test "list_platforms/0 returns all platforms" do
|
||||
platform = platform_fixture()
|
||||
|
@ -2,6 +2,7 @@ defmodule Bright.StreamsTest do
|
||||
use Bright.DataCase
|
||||
|
||||
alias Bright.Streams
|
||||
require Logger
|
||||
|
||||
describe "streams" do
|
||||
alias Bright.Streams.Stream
|
||||
@ -70,9 +71,10 @@ defmodule Bright.StreamsTest do
|
||||
alias Bright.Streams.Vod
|
||||
|
||||
import Bright.StreamsFixtures
|
||||
import Bright.TorrentsFixtures
|
||||
|
||||
@invalid_attrs %{
|
||||
stream_id: nil,
|
||||
stream_id: "this is very invalid",
|
||||
s3_cdn_url: nil,
|
||||
s3_key: nil,
|
||||
s3_bucket: nil,
|
||||
@ -86,8 +88,9 @@ defmodule Bright.StreamsTest do
|
||||
end
|
||||
|
||||
test "get_vod!/1 returns the vod with given id" do
|
||||
torrent = torrent_fixture()
|
||||
stream = stream_fixture()
|
||||
vod = vod_fixture(%{stream_id: stream.id})
|
||||
vod = vod_fixture(%{stream_id: stream.id, torrent_id: torrent.id})
|
||||
assert Streams.get_vod!(vod.id) == vod
|
||||
end
|
||||
|
||||
@ -103,8 +106,8 @@ defmodule Bright.StreamsTest do
|
||||
}
|
||||
|
||||
assert {:ok, %Vod{} = vod} = Streams.create_vod(valid_attrs)
|
||||
Logger.debug("just created vod and the vod is vod=#{inspect(vod)}")
|
||||
assert vod.s3_cdn_url == "some s3_cdn_url"
|
||||
assert vod.torrent == "some torrent"
|
||||
end
|
||||
|
||||
test "create_vod/1 with invalid data returns error changeset" do
|
||||
@ -119,13 +122,12 @@ defmodule Bright.StreamsTest do
|
||||
s3_cdn_url: "some updated s3_cdn_url",
|
||||
s3_upload_id: "some updated s3_upload_id",
|
||||
s3_key: "some updated s3_key",
|
||||
s3_bucket: "some updated s3_bucket",
|
||||
torrent: "some updated torrent"
|
||||
s3_bucket: "some updated s3_bucket"
|
||||
}
|
||||
|
||||
assert {:ok, %Vod{} = vod} = Streams.update_vod(vod, update_attrs)
|
||||
Logger.debug("Streams.update_vod just ran, and the vod is vod=#{inspect(vod)}")
|
||||
assert vod.s3_cdn_url == "some updated s3_cdn_url"
|
||||
assert vod.torrent == "some updated torrent"
|
||||
end
|
||||
|
||||
test "update_vod/2 with invalid data returns error changeset" do
|
||||
@ -165,6 +167,7 @@ defmodule Bright.StreamsTest do
|
||||
|
||||
@tag :integration
|
||||
@tag :slow
|
||||
@tag timeout: 120_000
|
||||
test "transmux_to_hls/2" do
|
||||
stream = stream_fixture()
|
||||
|
||||
|
@ -26,16 +26,15 @@ defmodule Bright.TorrentfileTest do
|
||||
|
||||
test "create/2" do
|
||||
input_path = @test_ts_fixture
|
||||
output_path = Cache.generate_filename("test", "torrent")
|
||||
stream = stream_fixture()
|
||||
vod = vod_fixture(%{stream_id: stream.id})
|
||||
{:ok, output} = Torrentfile.create(vod, input_path)
|
||||
assert :ok
|
||||
assert is_binary(output.save_path)
|
||||
assert output.save_path === output_path
|
||||
assert output.save_path =~ ".torrent"
|
||||
assert is_binary(output.btih)
|
||||
assert is_binary(output.btmh)
|
||||
assert File.exists?(output_path)
|
||||
assert File.exists?(output.save_path)
|
||||
end
|
||||
|
||||
test "create/7" do
|
||||
|
@ -1,4 +1,5 @@
|
||||
defmodule Bright.TrackerTest do
|
||||
require Logger
|
||||
use Bright.DataCase
|
||||
|
||||
alias Bright.Tracker
|
||||
@ -13,9 +14,17 @@ defmodule Bright.TrackerTest do
|
||||
|
||||
@tag :integration
|
||||
test "whitelist_info_hash/1 using a string info_hash" do
|
||||
{:ok, result} = Tracker.whitelist_info_hash(@info_hash_v1_fixture)
|
||||
assert :ok
|
||||
assert result === "Successfully added to whitelist"
|
||||
case Tracker.whitelist_info_hash(@info_hash_v1_fixture) do
|
||||
{:ok, result} ->
|
||||
assert :ok
|
||||
assert result === "Successfully added to whitelist"
|
||||
|
||||
{:error, :closed} ->
|
||||
flunk("The connection to opentracker was closed. Is opentracker running?")
|
||||
|
||||
other ->
|
||||
flunk("Unexpected result: #{inspect(other)}")
|
||||
end
|
||||
end
|
||||
|
||||
@tag :integration
|
||||
@ -26,8 +35,19 @@ defmodule Bright.TrackerTest do
|
||||
assert is_map(body) or is_list(body)
|
||||
|
||||
{:error, "Requested download is not authorized for use with this tracker."} ->
|
||||
Logger.warning(
|
||||
"info_hash '#{@info_hash_v1_fixture}' is not on the tracker's whitelist."
|
||||
)
|
||||
|
||||
Logger.warning(
|
||||
"Since this is an integration test, and the tracker behavior is not the unit under test, we are passing the test."
|
||||
)
|
||||
|
||||
assert true
|
||||
|
||||
{:error, :closed} ->
|
||||
flunk("The connection to opentracker was closed. Is opentracker running?")
|
||||
|
||||
other ->
|
||||
flunk("Unexpected result: #{inspect(other)}")
|
||||
end
|
||||
|
@ -1,16 +1,18 @@
|
||||
{
|
||||
auto_https off
|
||||
admin off
|
||||
http_port 8666
|
||||
auto_https off
|
||||
admin off
|
||||
http_port 8666
|
||||
}
|
||||
|
||||
|
||||
|
||||
:8666 {
|
||||
reverse_proxy 127.0.0.1:6969
|
||||
reverse_proxy 127.0.0.1:6969
|
||||
|
||||
route /whitelist* {
|
||||
basic_auth /whitelist {
|
||||
{$WHITELIST_USERNAME} {$WHITELIST_PASSWORD_CADDY}
|
||||
}
|
||||
reverse_proxy 127.0.0.1:3001
|
||||
}
|
||||
}
|
||||
route /whitelist* {
|
||||
basic_auth /whitelist {
|
||||
{$WHITELIST_USERNAME} {$WHITELIST_PASSWORD_CADDY}
|
||||
}
|
||||
reverse_proxy 127.0.0.1:3001
|
||||
}
|
||||
}
|
@ -4,12 +4,12 @@
|
||||
|
||||
# curl -sS --request GET --url "${WHITELIST_FEED_URL}" --header 'accept: text/plain' -o /etc/opentracker/whitelist
|
||||
|
||||
# exec 2>&1
|
||||
# exec /bin/opentracker -f /etc/opentracker/opentracker.conf
|
||||
|
||||
|
||||
echo "Loading torrent whitelist from ${WHITELIST_FEED_URL}"
|
||||
curl -sS --request GET --url "${WHITELIST_FEED_URL}" --header 'accept: text/plain' -o /etc/opentracker/whitelist
|
||||
|
||||
echo "Starting caddy"
|
||||
/usr/bin/caddy run --config /etc/caddy/Caddyfile
|
||||
exec 2>&1
|
||||
exec /usr/bin/caddy run --config /etc/caddy/Caddyfile
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user