From fbefe343ff79f63cb02e77e0e90e301f2f58b260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 24 Jul 2024 12:59:23 +0200 Subject: [PATCH 1/2] GitHub Actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .github/workflows/pl.yaml | 113 ++++++++++++++++++ mix.exs | 2 +- mix.lock | 8 +- test/mix/tasks/pleroma/database_test.exs | 4 +- .../controllers/media_controller_test.exs | 2 + .../mastodon_api/update_credentials_test.exs | 6 + 6 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/pl.yaml diff --git a/.github/workflows/pl.yaml b/.github/workflows/pl.yaml new file mode 100644 index 000000000..0e095df3d --- /dev/null +++ b/.github/workflows/pl.yaml @@ -0,0 +1,113 @@ +name: PL CI + +on: + push: + branches: [ "fork" ] + pull_request: + branches: [ "fork" ] + +env: + ELIXIR_VER: 1.15.8 + POSTGRES_DB: pleroma_test + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + # DB_HOST: postgres + DB_PORT: "5432" + MIX_ENV: test + +permissions: + contents: read + + +jobs: + test: + # Set up a Postgres DB service. By default, Phoenix applications + # use Postgres. This creates a database for running tests. + # Additional services can be defined here if required. + services: + db: + image: postgres:12 + ports: ['5432:5432'] + env: + POSTGRES_DB: pleroma_test + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + runs-on: ubuntu-latest + name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} + strategy: + # Specify the OTP and Elixir versions to use when building + # and running the workflow steps. + matrix: + otp: ['25.0.4'] # Define the OTP version [required] + elixir: ['1.15.8'] # Define the elixir version [required] + steps: + # Step: Install system dependencies + - name: Install system dependencies + run: sudo apt install -y imagemagick ffmpeg libimage-exiftool-perl + + # Step: Setup Elixir + Erlang image as the base. + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + + # Step: Check out the code. + - name: Checkout code + uses: actions/checkout@v3 + + # Step: Define how to cache deps. Restores existing cache if present. + - name: Cache deps + id: cache-deps + uses: actions/cache@v3 + env: + cache-name: cache-elixir-deps + with: + path: deps + key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ env.cache-name }}- + + # Step: Define how to cache the `_build` directory. After the first run, + # this speeds up tests runs a lot. This includes not re-compiling our + # project's downloaded deps every run. + - name: Cache compiled build + id: cache-build + uses: actions/cache@v3 + env: + cache-name: cache-compiled-build + with: + path: _build + key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ env.cache-name }}- + ${{ runner.os }}-mix- + + # Step: Download project dependencies. If unchanged, uses + # the cached version. + - name: Install dependencies + run: mix deps.get + + # Step: Compile the project treating any warnings as errors. + # Customize this step if a different behavior is desired. + - name: Compiles without warnings + run: mix compile --warnings-as-errors + + # Step: Check that the checked in code has already been formatted. + # This step fails if something was found unformatted. + # Customize this step as desired. + - name: Check Formatting + run: mix format --check-formatted + + # Step: Execute the tests. + - name: Run tests + run: | + mix ecto.create + mix ecto.migrate + mix pleroma.test_runner --cover --preload-modules \ No newline at end of file diff --git a/mix.exs b/mix.exs index 532df83d9..d4236232f 100644 --- a/mix.exs +++ b/mix.exs @@ -206,7 +206,7 @@ defmodule Pleroma.Mixfile do {:websock_adapter, "~> 0.5.6"}, {:oban_live_dashboard, "~> 0.1.1"}, {:icalendar, "~> 1.1"}, - {:geospatial, "~> 0.3.0"}, + {:geospatial, "~> 0.3.1"}, ## dev & test {:phoenix_live_reload, "~> 1.3.3", only: :dev}, diff --git a/mix.lock b/mix.lock index e715de26b..4f76f2d90 100644 --- a/mix.lock +++ b/mix.lock @@ -61,7 +61,7 @@ "gen_stage": {:hex, :gen_stage, "0.14.3", "d0c66f1c87faa301c1a85a809a3ee9097a4264b2edf7644bf5c123237ef732bf", [:mix], [], "hexpm"}, "gen_state_machine": {:hex, :gen_state_machine, "2.0.5", "9ac15ec6e66acac994cc442dcc2c6f9796cf380ec4b08267223014be1c728a95", [:mix], [], "hexpm"}, "geo": {:hex, :geo, "3.6.0", "00c9c6338579f67e91cd5950af4ae2eb25cdce0c3398718c232539f61625d0bd", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "1dbdebf617183b54bc3c8ad7a36531a9a76ada8ca93f75f573b0ae94006168da"}, - "geospatial": {:hex, :geospatial, "0.3.0", "73f397ebbe475442771822b8defe34200dad2f81b4e1cc79c7fd254e6c77d927", [:mix], [{:geo, "~> 3.6.0", [hex: :geo, repo: "hexpm", optional: false]}, {:hackney, "~> 1.20.1", [hex: :hackney, repo: "hexpm", optional: false]}, {:tesla, "~> 1.8.0", [hex: :tesla, repo: "hexpm", optional: false]}, {:tz_world, "~> 1.3.2", [hex: :tz_world, repo: "hexpm", optional: false]}], "hexpm", "b9212d95bf9aca187033bfdd74ce54c49cc9c66c83aa00723d5373db976e7ff4"}, + "geospatial": {:hex, :geospatial, "0.3.1", "0c8ca9746e44382a43eddd7b353af9aad7c0c5acd0edc78c765ec2566ab7b891", [:mix], [{:geo, "~> 3.6.0", [hex: :geo, repo: "hexpm", optional: false]}, {:hackney, "~> 1.20.1", [hex: :hackney, repo: "hexpm", optional: false]}, {:tesla, "~> 1.11.0", [hex: :tesla, repo: "hexpm", optional: false]}, {:tz_world, "~> 1.3.2", [hex: :tz_world, repo: "hexpm", optional: false]}], "hexpm", "ef5725a7f39551eb43986790077d10065720c020c32f16f60a86f8278c7697e3"}, "gettext": {:hex, :gettext, "0.24.0", "6f4d90ac5f3111673cbefc4ebee96fe5f37a114861ab8c7b7d5b30a1108ce6d8", [:mix], [{:expo, "~> 0.5.1", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "bdf75cdfcbe9e4622dd18e034b227d77dd17f0f133853a1c73b97b3d6c770e8b"}, "glob": {:hex, :glob, "1.0.0", "b4d54d66e7797ce037cdd18f2587fc9932187355340e222cafe125cd333d7a0a", [:rebar3], [], "hexpm", "ca25de25ac5a762ba6c979718ae6afef8402cfc9155b87479d215fbe676801e1"}, "gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"}, @@ -87,7 +87,7 @@ "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"}, "mimerl": {:hex, :mimerl, "1.3.0", "d0cd9fc04b9061f82490f6581e0128379830e78535e017f7780f37fea7545726", [:rebar3], [], "hexpm", "a1e15a50d1887217de95f0b9b0793e32853f7c258a5cd227650889b38839fe9d"}, - "mint": {:hex, :mint, "1.6.1", "065e8a5bc9bbd46a41099dfea3e0656436c5cbcb6e741c80bd2bad5cd872446f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4fc518dcc191d02f433393a72a7ba3f6f94b101d094cb6bf532ea54c89423780"}, + "mint": {:hex, :mint, "1.6.2", "af6d97a4051eee4f05b5500671d47c3a67dac7386045d87a904126fd4bbcea2e", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "5ee441dffc1892f1ae59127f74afe8fd82fda6587794278d924e4d90ea3d63f9"}, "mochiweb": {:hex, :mochiweb, "2.18.0", "eb55f1db3e6e960fac4e6db4e2db9ec3602cc9f30b86cd1481d56545c3145d2e", [:rebar3], [], "hexpm"}, "mock": {:hex, :mock, "0.3.8", "7046a306b71db2488ef54395eeb74df0a7f335a7caca4a3d3875d1fc81c884dd", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "7fa82364c97617d79bb7d15571193fc0c4fe5afd0c932cef09426b3ee6fe2022"}, "mogrify": {:hex, :mogrify, "0.8.0", "3506f3ca3f7b95a155f3b4ef803b5db176f5a0633723e3fe85e0d6399e3b11c8", [:mix], [], "hexpm", "2278d245f07056ea3b586e98801e933695147066fa4cf563f552c1b4f0ff8ad9"}, @@ -146,12 +146,12 @@ "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.2", "2caabe9344ec17eafe5403304771c3539f3b6e2f7fb6a6f602558c825d0d0bfb", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9b43db0dc33863930b9ef9d27137e78974756f5f198cae18409970ed6fa5b561"}, "telemetry_metrics_prometheus_core": {:hex, :telemetry_metrics_prometheus_core, "1.2.0", "b583c3f18508f5c5561b674d16cf5d9afd2ea3c04505b7d92baaeac93c1b8260", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "9cba950e1c4733468efbe3f821841f34ac05d28e7af7798622f88ecdbbe63ea3"}, "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, - "tesla": {:hex, :tesla, "1.11.0", "81b2b10213dddb27105ec6102d9eb0cc93d7097a918a0b1594f2dfd1a4601190", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "b83ab5d4c2d202e1ea2b7e17a49f788d49a699513d7c4f08f2aef2c281be69db"}, + "tesla": {:hex, :tesla, "1.11.2", "24707ac48b52f72f88fc05d242b1c59a85d1ee6f16f19c312d7d3419665c9cd5", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "c549cd03aec6a7196a641689dd378b799e635eb393f689b4bd756f750c7a4014"}, "thousand_island": {:hex, :thousand_island, "1.3.5", "6022b6338f1635b3d32406ff98d68b843ba73b3aa95cfc27154223244f3a6ca5", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2be6954916fdfe4756af3239fb6b6d75d0b8063b5df03ba76fd8a4c87849e180"}, "timex": {:hex, :timex, "3.7.7", "3ed093cae596a410759104d878ad7b38e78b7c2151c6190340835515d4a46b8a", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "0ec4b09f25fe311321f9fc04144a7e3affe48eb29481d7a5583849b6c4dfa0a7"}, "toml": {:hex, :toml, "0.7.0", "fbcd773caa937d0c7a02c301a1feea25612720ac3fa1ccb8bfd9d30d822911de", [:mix], [], "hexpm", "0690246a2478c1defd100b0c9b89b4ea280a22be9a7b313a8a058a2408a2fa70"}, "trailing_format_plug": {:hex, :trailing_format_plug, "0.0.7", "64b877f912cf7273bed03379936df39894149e35137ac9509117e59866e10e45", [:mix], [{:plug, "> 0.12.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bd4fde4c15f3e993a999e019d64347489b91b7a9096af68b2bdadd192afa693f"}, - "tz_world": {:hex, :tz_world, "1.3.2", "15d331ad1ff22735dfcc8c98bfc7b2a9fdc17f1f071e31e21cdafe2d9318a300", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:geo, "~> 1.0 or ~> 2.0 or ~> 3.3", [hex: :geo, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d1a345e07b3378c4c902ad54fbd5d54c8c3dd55dba883b7407fe57bcec45ff2a"}, + "tz_world": {:hex, :tz_world, "1.3.3", "6d847a8f24d84f091d3385769dad96a27170e8e9a03f5ded9fd86299a99c67b1", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:geo, "~> 1.0 or ~> 2.0 or ~> 3.3", [hex: :geo, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "dae9f255954c767fa4e36fa68b2927310a7192b525e10f860a6f4656aab23746"}, "tzdata": {:hex, :tzdata, "1.0.5", "69f1ee029a49afa04ad77801febaf69385f3d3e3d1e4b56b9469025677b89a28", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "55519aa2a99e5d2095c1e61cc74c9be69688f8ab75c27da724eb8279ff402a5a"}, "ueberauth": {:hex, :ueberauth, "0.10.7", "5a31cbe11e7ce5c7484d745dc9e1f11948e89662f8510d03c616de03df581ebd", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "0bccf73e2ffd6337971340832947ba232877aa8122dba4c95be9f729c8987377"}, "ueberauth_facebook": {:hex, :ueberauth_facebook, "0.8.0", "9ec8571f804dd5c06f4e305d70606b39fc0ac8a8f43ed56ebb76012a97d14729", [:mix], [{:oauth2, "~> 0.9", [hex: :oauth2, repo: "hexpm", optional: false]}, {:ueberauth, "~> 0.4", [hex: :ueberauth, repo: "hexpm", optional: false]}], "hexpm", "6d0c88d6ea4cc40cf99b3abcf8aaa435a31f836dc8921e8b4015d760e183f7ba"}, diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index d773038cb..cc25b7043 100644 --- a/test/mix/tasks/pleroma/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs @@ -387,6 +387,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do ["data_migration_failed_ids"], ["data_migrations"], ["deliveries"], + ["domains"], ["filters"], ["following_relationships"], ["hashtags"], @@ -416,7 +417,8 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do ["user_invite_tokens"], ["user_notes"], ["user_relationships"], - ["users"] + ["users"], + ["webhooks"] ] end diff --git a/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs index 4adbaa640..6fc358f5f 100644 --- a/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs @@ -81,6 +81,8 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8 + File.mkdir_p!(Path.absname("test/tmp")) + assert :ok == File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>) diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index b1cb2e98f..b07e1a7de 100644 --- a/test/pleroma/web/mastodon_api/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -307,6 +307,8 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do test "updates the user's avatar, upload_limit, returns a HTTP 413", %{conn: conn, user: user} do upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8 + File.mkdir_p!(Path.absname("test/tmp")) + assert :ok == File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>) @@ -354,6 +356,8 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do test "updates the user's banner, upload_limit, returns a HTTP 413", %{conn: conn, user: user} do upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8 + File.mkdir_p!(Path.absname("test/tmp")) + assert :ok == File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>) @@ -406,6 +410,8 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do } do upload_limit = Config.get([:instance, :upload_limit]) * 8 + 8 + File.mkdir_p!(Path.absname("test/tmp")) + assert :ok == File.write(Path.absname("test/tmp/large_binary.data"), <<0::size(upload_limit)>>) From 9d40689e4700f0eacbd50c6fe4cfa68ca5b25034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 25 Jul 2024 14:23:03 +0200 Subject: [PATCH 2/2] update test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .github/workflows/pl.yaml | 33 ++--------- .../20200806175913_rename_instance_chat.exs | 2 - .../transmogrifier/question_handling_test.exs | 2 +- test/pleroma/webhook_test.ex | 57 ------------------- 4 files changed, 6 insertions(+), 88 deletions(-) delete mode 100644 test/pleroma/webhook_test.ex diff --git a/.github/workflows/pl.yaml b/.github/workflows/pl.yaml index 0e095df3d..5f0d082a9 100644 --- a/.github/workflows/pl.yaml +++ b/.github/workflows/pl.yaml @@ -1,4 +1,6 @@ -name: PL CI +# Adapter from https://fly.io/phoenix-files/github-actions-for-elixir-ci/ + +name: pl CI on: push: @@ -9,21 +11,13 @@ on: env: ELIXIR_VER: 1.15.8 POSTGRES_DB: pleroma_test - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - # DB_HOST: postgres - DB_PORT: "5432" MIX_ENV: test permissions: contents: read - jobs: test: - # Set up a Postgres DB service. By default, Phoenix applications - # use Postgres. This creates a database for running tests. - # Additional services can be defined here if required. services: db: image: postgres:12 @@ -41,28 +35,22 @@ jobs: runs-on: ubuntu-latest name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} strategy: - # Specify the OTP and Elixir versions to use when building - # and running the workflow steps. matrix: - otp: ['25.0.4'] # Define the OTP version [required] - elixir: ['1.15.8'] # Define the elixir version [required] + otp: ['26.2.5'] + elixir: ['1.15.8'] steps: - # Step: Install system dependencies - name: Install system dependencies run: sudo apt install -y imagemagick ffmpeg libimage-exiftool-perl - # Step: Setup Elixir + Erlang image as the base. - name: Set up Elixir uses: erlef/setup-beam@v1 with: otp-version: ${{matrix.otp}} elixir-version: ${{matrix.elixir}} - # Step: Check out the code. - name: Checkout code uses: actions/checkout@v3 - # Step: Define how to cache deps. Restores existing cache if present. - name: Cache deps id: cache-deps uses: actions/cache@v3 @@ -74,9 +62,6 @@ jobs: restore-keys: | ${{ runner.os }}-mix-${{ env.cache-name }}- - # Step: Define how to cache the `_build` directory. After the first run, - # this speeds up tests runs a lot. This includes not re-compiling our - # project's downloaded deps every run. - name: Cache compiled build id: cache-build uses: actions/cache@v3 @@ -89,23 +74,15 @@ jobs: ${{ runner.os }}-mix-${{ env.cache-name }}- ${{ runner.os }}-mix- - # Step: Download project dependencies. If unchanged, uses - # the cached version. - name: Install dependencies run: mix deps.get - # Step: Compile the project treating any warnings as errors. - # Customize this step if a different behavior is desired. - name: Compiles without warnings run: mix compile --warnings-as-errors - # Step: Check that the checked in code has already been formatted. - # This step fails if something was found unformatted. - # Customize this step as desired. - name: Check Formatting run: mix format --check-formatted - # Step: Execute the tests. - name: Run tests run: | mix ecto.create diff --git a/priv/repo/migrations/20200806175913_rename_instance_chat.exs b/priv/repo/migrations/20200806175913_rename_instance_chat.exs index 44d353099..a89c15057 100644 --- a/priv/repo/migrations/20200806175913_rename_instance_chat.exs +++ b/priv/repo/migrations/20200806175913_rename_instance_chat.exs @@ -5,8 +5,6 @@ defmodule Pleroma.Repo.Migrations.RenameInstanceChat do use Ecto.Migration - alias Pleroma.ConfigDB - def up, do: :noop def down, do: :noop end diff --git a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs index 100210826..ca921d77c 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs @@ -182,7 +182,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do }) object = Object.normalize(activity, fetch: false) - {:ok, _, _} = CommonAPI.vote(other_user, object, [1]) + {:ok, _, _} = CommonAPI.vote(object, other_user, [1]) {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) diff --git a/test/pleroma/webhook_test.ex b/test/pleroma/webhook_test.ex deleted file mode 100644 index 21763f1e0..000000000 --- a/test/pleroma/webhook_test.ex +++ /dev/null @@ -1,57 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2022 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.WebhookTest do - use Pleroma.DataCase, async: true - - alias Pleroma.Repo - alias Pleroma.Webhook - - test "creating a webhook" do - %{id: id} = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]}) - - assert %{url: "https://example.com/webhook"} = Webhook.get(id) - end - - test "editing a webhook" do - %{id: id} = - webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]}) - - Webhook.update(webhook, %{events: [:"account.created"]}) - - assert %{events: [:"account.created"]} = Webhook.get(id) - end - - test "filter webhooks by type" do - %{id: id1} = - Webhook.create(%{url: "https://example.com/webhook1", events: [:"report.created"]}) - - %{id: id2} = - Webhook.create(%{ - url: "https://example.com/webhook2", - events: [:"account.created", :"report.created"] - }) - - Webhook.create(%{url: "https://example.com/webhook3", events: [:"account.created"]}) - - assert [%{id: ^id1}, %{id: ^id2}] = Webhook.get_by_type(:"report.created") - end - - test "change webhook state" do - %{id: id, enabled: true} = - webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]}) - - Webhook.set_enabled(webhook, false) - assert %{enabled: false} = Webhook.get(id) - end - - test "rotate webhook secrets" do - %{id: id, secret: secret} = - webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]}) - - Webhook.rotate_secret(webhook) - %{secret: new_secret} = Webhook.get(id) - assert secret != new_secret - end -end