Skip to content
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
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.6.2"
}
75 changes: 75 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"bootstrap-sha": "f471986",
"pull-request-header": ":rocket: Want to release this?",
"pull-request-title-pattern": "chore: release ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "feature",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "style",
"section": "Styles",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": false
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": false
},
{
"type": "build",
"section": "Build System",
"hidden": false
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": false
}
],
"extra-files": [
{
"type": "generic",
"path": "README.md",
"glob": false
}
],
"packages": {
".": {
"release-type": "elixir"
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
84 changes: 62 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,23 @@ jobs:

strategy:
matrix:
elixir: [1.18.1]
otp: [27.0]
include:
- elixir: 1.18
otp: 28
- elixir: 1.18
otp: 27
- elixir: 1.18
otp: 26
- elixir: 1.17
otp: 27
- elixir: 1.17
otp: 26
- elixir: 1.17
otp: 25
- elixir: 1.16
otp: 25
- elixir: 1.16
otp: 24

steps:
- name: Checkout code
Expand Down Expand Up @@ -59,21 +74,37 @@ jobs:
run: mix clean

- name: Check code formatting
if: matrix.elixir != '1.16'
run: mix format --check-formatted

- name: Run Credo
run: mix credo --strict

static-analisys:
static-analysis:
runs-on: ubuntu-latest

env:
MIX_ENV: test

strategy:
matrix:
elixir: [1.18.1]
otp: [27.0]
include:
- elixir: 1.18
otp: 28
- elixir: 1.18
otp: 27
- elixir: 1.18
otp: 26
- elixir: 1.17
otp: 27
- elixir: 1.17
otp: 26
- elixir: 1.17
otp: 25
- elixir: 1.16
otp: 25
- elixir: 1.16
otp: 24

steps:
- name: Checkout code
Expand Down Expand Up @@ -110,29 +141,23 @@ jobs:
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile --warnings-as-errors

# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
- name: Restore PLT cache
uses: actions/cache/restore@v3
# Ensure PLTs directory exists
- name: Create PLTs directory
run: mkdir -p priv/plts

# Cache PLTs based on Elixir & Erlang version + mix.lock hash
- name: Restore/Save PLT cache
uses: actions/cache@v4
id: plt_cache
with:
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
restore-keys: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
path: priv/plts
key: plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}

# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt

- name: Save PLT cache
uses: actions/cache/save@v3
if: steps.plt_cache.outputs.cache-hit != 'true'
id: plt_cache_save
with:
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
path: priv/plts

- name: Run dialyzer
run: mix dialyzer --format github

Expand All @@ -144,8 +169,23 @@ jobs:

strategy:
matrix:
elixir: [1.18.1]
otp: [27.0]
include:
- elixir: 1.18
otp: 28
- elixir: 1.18
otp: 27
- elixir: 1.18
otp: 26
- elixir: 1.17
otp: 27
- elixir: 1.17
otp: 26
- elixir: 1.17
otp: 25
- elixir: 1.16
otp: 25
- elixir: 1.16
otp: 24

steps:
- name: Checkout code
Expand Down Expand Up @@ -186,4 +226,4 @@ jobs:
run: mix clean

- name: Run tests
run: mix test
run: mix test --warnings-as-errors
66 changes: 66 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish to Hex

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest

env:
MIX_ENV: test

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

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: 1.18
otp-version: 28

- name: Cache Elixir deps
uses: actions/cache@v4
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-hex-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Cache Elixir _build
uses: actions/cache@v4
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-hex-${{ env.MIX_ENV }}-27-1.18-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Install deps
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get

- name: Compile deps
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile

- name: Compile
run: mix compile --warnings-as-errors

- name: Run tests
run: mix test --warnings-as-errors

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

- name: Run Credo
run: mix credo --strict

- name: Publish to Hex
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --yes
25 changes: 25 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: Release Please

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def deps do
[
{:supabase_potion, "~> 0.6"}, # base SDK
{:supabase_storage, "~> 0.4"}, # storage integration
{:supabase_gotrue, "~> 0.4"}, # auth integration
{:supabase_auth, "~> 0.6"}, # auth integration
{:supabase_postgrest, "~> 1.0"}, # postgrest integration
{:supabase_functions, "~> 0.1"}, # edge functions integration
{:supabase_realtime, "~> 0.1"}, # realtime integration
Expand All @@ -20,28 +20,13 @@ Individual product client documentation:
- [PostgREST](https://github.com/supabase-community/postgres-ex)
- [Storage](https://github.com/supabase-community/storage-ex)
- [Auth](https://github.com/supabase-community/auth-ex)
- [Functions](https://github.com/supabase-community/functions-ex)
- [Realtime](https://github.com/supabase-community/realtime-ex)

### Clients

A `Supabase.Client` holds general information about Supabase, that can be used to intereact with any of the children integrations, for example: `Supabase.Storage` or `Supabase.UI`.

`Supabase.Client` is defined as:

- `:base_url` - The base url of the Supabase API, it is usually in the form `https://<app-name>.supabase.io`.
- `:api_key` - The API key used to authenticate requests to the Supabase API.
- `:access_token` - Token with specific permissions to access the Supabase API, it is usually the same as the API key.
- `:db` - default database options
- `:schema` - default schema to use, defaults to `"public"`
- `:global` - global options config
- `:headers` - additional headers to use on each request
- `:auth` - authentication options
- `:auto_refresh_token` - automatically refresh the token when it expires, defaults to `true`
- `:debug` - enable debug mode, defaults to `false`
- `:detect_session_in_url` - detect session in URL, defaults to `true`
- `:flow_type` - authentication flow type, defaults to `"web"`
- `:persist_session` - persist session, defaults to `true`
- `:storage_key` - storage key

### Usage

There are two ways to create a `Supabase.Client`:
Expand Down
Loading