Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions workflow #2

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/pl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Adapter from https://fly.io/phoenix-files/github-actions-for-elixir-ci/

name: pl CI

on:
push:
branches: [ "fork" ]
pull_request:
branches: [ "fork" ]

env:
ELIXIR_VER: 1.15.8
POSTGRES_DB: pleroma_test
MIX_ENV: test

permissions:
contents: read

jobs:
test:
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:
matrix:
otp: ['26.2.5']
elixir: ['1.15.8']
steps:
- name: Install system dependencies
run: sudo apt install -y imagemagick ffmpeg libimage-exiftool-perl

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Checkout code
uses: actions/checkout@v3

- 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 }}-

- 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-

- name: Install dependencies
run: mix deps.get

- name: Compiles without warnings
run: mix compile --warnings-as-errors

- name: Check Formatting
run: mix format --check-formatted

- name: Run tests
run: |
mix ecto.create
mix ecto.migrate
mix pleroma.test_runner --cover --preload-modules
2 changes: 0 additions & 2 deletions priv/repo/migrations/20200806175913_rename_instance_chat.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion test/mix/tasks/pleroma/database_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
["data_migration_failed_ids"],
["data_migrations"],
["deliveries"],
["domains"],
["filters"],
["following_relationships"],
["hashtags"],
Expand Down Expand Up @@ -416,7 +417,8 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
["user_invite_tokens"],
["user_notes"],
["user_relationships"],
["users"]
["users"],
["webhooks"]
]
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)>>)

Expand Down
6 changes: 6 additions & 0 deletions test/pleroma/web/mastodon_api/update_credentials_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)>>)

Expand Down Expand Up @@ -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)>>)

Expand Down Expand Up @@ -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)>>)

Expand Down
57 changes: 0 additions & 57 deletions test/pleroma/webhook_test.ex

This file was deleted.

Loading