From 4bb578a1d76c8094db36021db0aed2dfcebd1dbc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 23 May 2021 18:31:07 -0500 Subject: [PATCH 1/4] Add cycles test to .gitlab-ci.yml Thank you @jb55@bitcoinhackers.org for the awk syntax --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b155c81bd..88504b3e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -154,6 +154,14 @@ analysis: script: - mix credo --strict --only=warnings,todo,fixme,consistency,readability +cycles: + stage: test + image: elixir:1.11 + script: + - mix deps.get + - mix compile + - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}' + docs-deploy: stage: deploy cache: *testing_cache_policy From cefb952dffb3f6fb3e515167e58f910e7e6fc8ea Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 9 Jun 2021 13:08:24 -0500 Subject: [PATCH 2/4] CI: echo $MIX_ENV --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88504b3e3..a790d60a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,7 @@ stages: - docker before_script: + - echo $MIX_ENV - rm -rf _build/*/lib/pleroma - apt-get update && apt-get install -y cmake - mix local.hex --force From 87cd04fe0c10f5952aa456237906e4c966e445ea Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 9 Jun 2021 13:12:33 -0500 Subject: [PATCH 3/4] Cycles CI: disable cache --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a790d60a4..056af56cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,6 +158,7 @@ analysis: cycles: stage: test image: elixir:1.11 + cache: {} script: - mix deps.get - mix compile From 15e2aaa9f6e2201c46d18d8ddead922a2ef3288f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 9 Jun 2021 13:30:19 -0500 Subject: [PATCH 4/4] Fix compile cycle in Pleroma.Tests.AuthTestController --- lib/pleroma/tests/auth_test_controller.ex | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/tests/auth_test_controller.ex b/lib/pleroma/tests/auth_test_controller.ex index ddf3fea4f..76514948b 100644 --- a/lib/pleroma/tests/auth_test_controller.ex +++ b/lib/pleroma/tests/auth_test_controller.ex @@ -9,7 +9,6 @@ defmodule Pleroma.Tests.AuthTestController do use Pleroma.Web, :controller alias Pleroma.User - alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Web.Plugs.OAuthScopesPlug # Serves only with proper OAuth token (:api and :authenticated_api) @@ -47,10 +46,7 @@ defmodule Pleroma.Tests.AuthTestController do # Via :authenticated_api, serves if token is present and has requested scopes # # Suggested use: as :fallback_oauth_check but open with nil :user for :api on private instances - plug( - :skip_plug, - EnsurePublicOrAuthenticatedPlug when action == :fallback_oauth_skip_publicity_check - ) + plug(:skip_public_check when action == :fallback_oauth_skip_publicity_check) plug( OAuthScopesPlug, @@ -62,11 +58,7 @@ defmodule Pleroma.Tests.AuthTestController do # Via :authenticated_api, serves if :user is set (regardless of token presence and its scopes) # # Suggested use: making an :api endpoint always accessible (e.g. email confirmation endpoint) - plug( - :skip_plug, - [OAuthScopesPlug, EnsurePublicOrAuthenticatedPlug] - when action == :skip_oauth_skip_publicity_check - ) + plug(:skip_auth when action == :skip_oauth_skip_publicity_check) # Via :authenticated_api, always fails with 403 (endpoint is insecure) # Via :api, drops :user if present and serves if public (private instance rejects on no user)