Skip to content

Commit

Permalink
Merge pull request #142 from ueberauth/yordis/chore-1
Browse files Browse the repository at this point in the history
chore: upgrade deps
  • Loading branch information
yordis authored Sep 11, 2023
2 parents 5224fa6 + f412797 commit 50f9f05
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 87 deletions.
86 changes: 26 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,60 @@
---

name: Continuous Integration

on:
pull_request:
types:
- opened
- reopened
- synchronize
types: [opened, reopened, synchronize]
push:
branches:
- master

- 'master'
jobs:
Test:
runs-on: ubuntu-latest

container:
image: elixir:1.11-alpine

services:
postgres:
image: postgres:11
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports: ["5432:5432"]

POSTGRES_DB: guardian_db_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v1
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
persist-credentials: false

- name: Install (mix)
elixir-version: "1.14"
otp-version: "24.3"
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
- name: Install (deps)
run: mix deps.get

mix deps.get
- name: Run Tests
run: mix test
env:
DB_HOST: postgres

Format:
Linting:
runs-on: ubuntu-latest

container:
image: elixir:1.11-alpine

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v1
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
persist-credentials: false

- name: Install (mix)
elixir-version: "1.14"
otp-version: "24.3"
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Formatter
run: mix format --check-formatted

Credo:
runs-on: ubuntu-latest

container:
image: elixir:1.11-alpine

steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Install (os)
run: apk add --no-cache gcc g++ git make musl-dev tar zstd

- name: Install (mix)
run: |
mix local.rebar --force
mix local.hex --force
- name: Install (deps)
run: mix deps.get

- name: Run Credo
run: mix credo
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ config :guardian_db, Guardian.DB.TestSupport.Repo,
database: "guardian_db_test",
pool: Ecto.Adapters.SQL.Sandbox,
priv: "priv/temp/guardian_db_test",
hostname: Map.get(System.get_env(), "DB_HOST", "localhost"),
hostname: "localhost",
username: "postgres",
password: "postgres"
2 changes: 0 additions & 2 deletions lib/guardian/db/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ defmodule Guardian.DB.Adapter do
for Guardian Tokens.
"""

@typep query :: Ecto.Query.t()
@typep schema :: Ecto.Schema.t()
@typep changeset :: Ecto.Changeset.t()
@typep schema_or_changeset :: schema() | changeset()
@typep claims :: map()
@typep exp :: pos_integer()
@typep sub :: binary()
@typep opts :: keyword()
@typep id :: pos_integer() | binary() | Ecto.UUID.t()

@doc """
Retrieves JWT token
Expand Down
1 change: 0 additions & 1 deletion lib/guardian/db/ecto_adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ defmodule Guardian.DB.EctoAdapter do
def purge_expired_tokens(timestamp, opts) do
prefix = Keyword.get(opts, :prefix, nil)
repo = Keyword.get(opts, :repo)
timestamp = Guardian.timestamp()

opts
|> query_schema()
Expand Down
2 changes: 0 additions & 2 deletions lib/guardian/db/ets_adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ defmodule Guardian.DB.ETSAdapter do
|> delete_many(table)
end

defp expired_tokens({_jti, _aud, _sub, token}, exp), do: token.exp < exp

defp delete_many(tokens, table) do
deleted_tokens =
Enum.reduce(tokens, [], fn [jti, token], acc ->
Expand Down
1 change: 0 additions & 1 deletion lib/guardian/db/token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ defmodule Guardian.DB.Token do

use Ecto.Schema
import Ecto.Changeset
import Ecto.Query, only: [where: 3]

alias Guardian.DB.Token

Expand Down
1 change: 0 additions & 1 deletion lib/mix/tasks/guardian_db.gen.migration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ defmodule Mix.Tasks.Guardian.Db.Gen.Migration do

import Mix.Ecto
import Mix.Generator
alias Guardian.DB.Token

@doc false
def run(args) do
Expand Down
42 changes: 23 additions & 19 deletions mix.lock

Large diffs are not rendered by default.

0 comments on commit 50f9f05

Please sign in to comment.