act_runner succeeds omg
This commit is contained in:
parent
4225bbdf61
commit
deb5ef397e
@ -26,7 +26,7 @@ jobs:
|
|||||||
# - name: Unit test all packages
|
# - name: Unit test all packages
|
||||||
# run: pnpm test -r
|
# run: pnpm test -r
|
||||||
|
|
||||||
test:
|
test_phoenix:
|
||||||
name: Tests & Checks
|
name: Tests & Checks
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
timeout-minutes: 600
|
timeout-minutes: 600
|
||||||
@ -48,6 +48,7 @@ jobs:
|
|||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
PUBLIC_S3_ENDPOINT: ${{ secrets.PUBLIC_S3_ENDPOINT }}
|
PUBLIC_S3_ENDPOINT: ${{ secrets.PUBLIC_S3_ENDPOINT }}
|
||||||
SITE_URL: https://futureporn.net
|
SITE_URL: https://futureporn.net
|
||||||
|
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
|
||||||
|
|
||||||
# @blocking @see https://gitea.com/gitea/act_runner/issues/506
|
# @blocking @see https://gitea.com/gitea/act_runner/issues/506
|
||||||
services:
|
services:
|
||||||
@ -140,3 +141,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mix coveralls
|
mix coveralls
|
||||||
working-directory: ./apps/bright
|
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": [
|
"recommendations": [
|
||||||
"helm-ls.helm-ls",
|
|
||||||
"tchoupinax.tilt",
|
|
||||||
"redhat.vscode-yaml",
|
"redhat.vscode-yaml",
|
||||||
"elixir-lsp.elixir-ls"
|
"elixir-lsp.elixir-ls"
|
||||||
]
|
]
|
||||||
|
@ -171,7 +171,7 @@ defmodule Bright.Streams do
|
|||||||
def list_vods do
|
def list_vods do
|
||||||
Vod
|
Vod
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
|> Repo.preload(:torrent)
|
|> Repo.preload([:torrent, :stream])
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -201,7 +201,7 @@ defmodule Bright.Streams do
|
|||||||
def get_vod!(id) do
|
def get_vod!(id) do
|
||||||
Vod
|
Vod
|
||||||
|> Repo.get!(id)
|
|> Repo.get!(id)
|
||||||
|> Repo.preload(:torrent)
|
|> Repo.preload([:torrent, :stream])
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -222,7 +222,7 @@ defmodule Bright.Streams do
|
|||||||
|> Repo.insert()
|
|> Repo.insert()
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %Vod{} = vod} ->
|
{:ok, %Vod{} = vod} ->
|
||||||
vod = Repo.preload(vod, [:torrent])
|
vod = Repo.preload(vod, [:torrent, :stream])
|
||||||
Oban.insert!(Bright.ObanWorkers.ProcessVod.new(%{vod_id: vod.id}))
|
Oban.insert!(Bright.ObanWorkers.ProcessVod.new(%{vod_id: vod.id}))
|
||||||
{:ok, vod}
|
{:ok, vod}
|
||||||
|
|
||||||
@ -265,6 +265,7 @@ defmodule Bright.Streams do
|
|||||||
"""
|
"""
|
||||||
def update_vod(%Vod{} = vod, attrs) do
|
def update_vod(%Vod{} = vod, attrs) do
|
||||||
vod
|
vod
|
||||||
|
|> Repo.preload([:stream, :torrent])
|
||||||
|> Vod.changeset(attrs)
|
|> Vod.changeset(attrs)
|
||||||
|> Repo.update()
|
|> Repo.update()
|
||||||
end
|
end
|
||||||
|
@ -105,7 +105,7 @@ defmodule Bright.Torrentfile do
|
|||||||
meta_version
|
meta_version
|
||||||
) do
|
) do
|
||||||
Logger.debug(
|
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(), [
|
case Rambo.run(torrentfile_path(), [
|
||||||
@ -127,7 +127,7 @@ defmodule Bright.Torrentfile do
|
|||||||
input_path
|
input_path
|
||||||
]) do
|
]) do
|
||||||
{:error, reason} -> {:error, reason}
|
{: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
|
||||||
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
|
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
|
test "list_platforms/0 returns all platforms" do
|
||||||
platform = platform_fixture()
|
platform = platform_fixture()
|
||||||
|
@ -2,6 +2,7 @@ defmodule Bright.StreamsTest do
|
|||||||
use Bright.DataCase
|
use Bright.DataCase
|
||||||
|
|
||||||
alias Bright.Streams
|
alias Bright.Streams
|
||||||
|
require Logger
|
||||||
|
|
||||||
describe "streams" do
|
describe "streams" do
|
||||||
alias Bright.Streams.Stream
|
alias Bright.Streams.Stream
|
||||||
@ -70,9 +71,10 @@ defmodule Bright.StreamsTest do
|
|||||||
alias Bright.Streams.Vod
|
alias Bright.Streams.Vod
|
||||||
|
|
||||||
import Bright.StreamsFixtures
|
import Bright.StreamsFixtures
|
||||||
|
import Bright.TorrentsFixtures
|
||||||
|
|
||||||
@invalid_attrs %{
|
@invalid_attrs %{
|
||||||
stream_id: nil,
|
stream_id: "this is very invalid",
|
||||||
s3_cdn_url: nil,
|
s3_cdn_url: nil,
|
||||||
s3_key: nil,
|
s3_key: nil,
|
||||||
s3_bucket: nil,
|
s3_bucket: nil,
|
||||||
@ -86,8 +88,9 @@ defmodule Bright.StreamsTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "get_vod!/1 returns the vod with given id" do
|
test "get_vod!/1 returns the vod with given id" do
|
||||||
|
torrent = torrent_fixture()
|
||||||
stream = stream_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
|
assert Streams.get_vod!(vod.id) == vod
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -103,8 +106,8 @@ defmodule Bright.StreamsTest do
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert {:ok, %Vod{} = vod} = Streams.create_vod(valid_attrs)
|
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.s3_cdn_url == "some s3_cdn_url"
|
||||||
assert vod.torrent == "some torrent"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "create_vod/1 with invalid data returns error changeset" do
|
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_cdn_url: "some updated s3_cdn_url",
|
||||||
s3_upload_id: "some updated s3_upload_id",
|
s3_upload_id: "some updated s3_upload_id",
|
||||||
s3_key: "some updated s3_key",
|
s3_key: "some updated s3_key",
|
||||||
s3_bucket: "some updated s3_bucket",
|
s3_bucket: "some updated s3_bucket"
|
||||||
torrent: "some updated torrent"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert {:ok, %Vod{} = vod} = Streams.update_vod(vod, update_attrs)
|
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.s3_cdn_url == "some updated s3_cdn_url"
|
||||||
assert vod.torrent == "some updated torrent"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update_vod/2 with invalid data returns error changeset" do
|
test "update_vod/2 with invalid data returns error changeset" do
|
||||||
@ -165,6 +167,7 @@ defmodule Bright.StreamsTest do
|
|||||||
|
|
||||||
@tag :integration
|
@tag :integration
|
||||||
@tag :slow
|
@tag :slow
|
||||||
|
@tag timeout: 120_000
|
||||||
test "transmux_to_hls/2" do
|
test "transmux_to_hls/2" do
|
||||||
stream = stream_fixture()
|
stream = stream_fixture()
|
||||||
|
|
||||||
|
@ -26,16 +26,15 @@ defmodule Bright.TorrentfileTest do
|
|||||||
|
|
||||||
test "create/2" do
|
test "create/2" do
|
||||||
input_path = @test_ts_fixture
|
input_path = @test_ts_fixture
|
||||||
output_path = Cache.generate_filename("test", "torrent")
|
|
||||||
stream = stream_fixture()
|
stream = stream_fixture()
|
||||||
vod = vod_fixture(%{stream_id: stream.id})
|
vod = vod_fixture(%{stream_id: stream.id})
|
||||||
{:ok, output} = Torrentfile.create(vod, input_path)
|
{:ok, output} = Torrentfile.create(vod, input_path)
|
||||||
assert :ok
|
assert :ok
|
||||||
assert is_binary(output.save_path)
|
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.btih)
|
||||||
assert is_binary(output.btmh)
|
assert is_binary(output.btmh)
|
||||||
assert File.exists?(output_path)
|
assert File.exists?(output.save_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "create/7" do
|
test "create/7" do
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
defmodule Bright.TrackerTest do
|
defmodule Bright.TrackerTest do
|
||||||
|
require Logger
|
||||||
use Bright.DataCase
|
use Bright.DataCase
|
||||||
|
|
||||||
alias Bright.Tracker
|
alias Bright.Tracker
|
||||||
@ -13,9 +14,17 @@ defmodule Bright.TrackerTest do
|
|||||||
|
|
||||||
@tag :integration
|
@tag :integration
|
||||||
test "whitelist_info_hash/1 using a string info_hash" do
|
test "whitelist_info_hash/1 using a string info_hash" do
|
||||||
{:ok, result} = Tracker.whitelist_info_hash(@info_hash_v1_fixture)
|
case Tracker.whitelist_info_hash(@info_hash_v1_fixture) do
|
||||||
|
{:ok, result} ->
|
||||||
assert :ok
|
assert :ok
|
||||||
assert result === "Successfully added to whitelist"
|
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
|
end
|
||||||
|
|
||||||
@tag :integration
|
@tag :integration
|
||||||
@ -26,8 +35,19 @@ defmodule Bright.TrackerTest do
|
|||||||
assert is_map(body) or is_list(body)
|
assert is_map(body) or is_list(body)
|
||||||
|
|
||||||
{:error, "Requested download is not authorized for use with this tracker."} ->
|
{: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
|
assert true
|
||||||
|
|
||||||
|
{:error, :closed} ->
|
||||||
|
flunk("The connection to opentracker was closed. Is opentracker running?")
|
||||||
|
|
||||||
other ->
|
other ->
|
||||||
flunk("Unexpected result: #{inspect(other)}")
|
flunk("Unexpected result: #{inspect(other)}")
|
||||||
end
|
end
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
http_port 8666
|
http_port 8666
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:8666 {
|
:8666 {
|
||||||
reverse_proxy 127.0.0.1:6969
|
reverse_proxy 127.0.0.1:6969
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
# curl -sS --request GET --url "${WHITELIST_FEED_URL}" --header 'accept: text/plain' -o /etc/opentracker/whitelist
|
# 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}"
|
echo "Loading torrent whitelist from ${WHITELIST_FEED_URL}"
|
||||||
curl -sS --request GET --url "${WHITELIST_FEED_URL}" --header 'accept: text/plain' -o /etc/opentracker/whitelist
|
curl -sS --request GET --url "${WHITELIST_FEED_URL}" --header 'accept: text/plain' -o /etc/opentracker/whitelist
|
||||||
|
|
||||||
echo "Starting caddy"
|
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