Skip to content

Commit b735b80

Browse files
committed
initial commit
0 parents  commit b735b80

File tree

14 files changed

+400
-0
lines changed

14 files changed

+400
-0
lines changed

.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

.github/pull_request_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Problem
2+
3+
<!-- what problem is the PR is trying to solve? -->
4+
5+
## Solution
6+
7+
<!-- how is the PR solving the problem? -->
8+
9+
## Rationale
10+
11+
<!-- why was it implemented the way it was? -->

.github/workflows/ci.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
MIX_ENV: test
17+
18+
strategy:
19+
matrix:
20+
elixir: [1.18.1]
21+
otp: [27.0]
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v3
26+
27+
- name: Set up Elixir
28+
uses: erlef/setup-beam@v1
29+
with:
30+
elixir-version: ${{ matrix.elixir }}
31+
otp-version: ${{ matrix.otp }}
32+
33+
- name: Cache Elixir deps
34+
uses: actions/cache@v1
35+
id: deps-cache
36+
with:
37+
path: deps
38+
key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
39+
40+
- name: Cache Elixir _build
41+
uses: actions/cache@v1
42+
id: build-cache
43+
with:
44+
path: _build
45+
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
46+
47+
- name: Install deps
48+
if: steps.deps-cache.outputs.cache-hit != 'true'
49+
run: |
50+
mix local.rebar --force
51+
mix local.hex --force
52+
mix deps.get --only ${{ env.MIX_ENV }}
53+
54+
- name: Compile deps
55+
if: steps.build-cache.outputs.cache-hit != 'true'
56+
run: mix deps.compile --warnings-as-errors
57+
58+
- name: Clean build
59+
run: mix clean
60+
61+
- name: Check code formatting
62+
run: mix format --check-formatted
63+
64+
- name: Run Credo
65+
run: mix credo --strict
66+
67+
static-analisys:
68+
runs-on: ubuntu-latest
69+
70+
env:
71+
MIX_ENV: test
72+
73+
strategy:
74+
matrix:
75+
elixir: [1.18.1]
76+
otp: [27.0]
77+
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v3
81+
82+
- name: Set up Elixir
83+
uses: erlef/setup-beam@v1
84+
with:
85+
elixir-version: ${{ matrix.elixir }}
86+
otp-version: ${{ matrix.otp }}
87+
88+
- name: Cache Elixir deps
89+
uses: actions/cache@v1
90+
id: deps-cache
91+
with:
92+
path: deps
93+
key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
94+
95+
- name: Cache Elixir _build
96+
uses: actions/cache@v1
97+
id: build-cache
98+
with:
99+
path: _build
100+
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
101+
102+
- name: Install deps
103+
if: steps.deps-cache.outputs.cache-hit != 'true'
104+
run: |
105+
mix local.rebar --force
106+
mix local.hex --force
107+
mix deps.get --only ${{ env.MIX_ENV }}
108+
109+
- name: Compile deps
110+
if: steps.build-cache.outputs.cache-hit != 'true'
111+
run: mix deps.compile --warnings-as-errors
112+
113+
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
114+
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
115+
- name: Restore PLT cache
116+
uses: actions/cache/restore@v3
117+
id: plt_cache
118+
with:
119+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
120+
restore-keys: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
121+
path: priv/plts
122+
123+
# Create PLTs if no cache was found
124+
- name: Create PLTs
125+
if: steps.plt_cache.outputs.cache-hit != 'true'
126+
run: mix dialyzer --plt
127+
128+
- name: Save PLT cache
129+
uses: actions/cache/save@v3
130+
if: steps.plt_cache.outputs.cache-hit != 'true'
131+
id: plt_cache_save
132+
with:
133+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
134+
path: priv/plts
135+
136+
- name: Run dialyzer
137+
run: mix dialyzer --format github
138+
139+
test:
140+
runs-on: ubuntu-latest
141+
142+
env:
143+
MIX_ENV: test
144+
145+
strategy:
146+
matrix:
147+
elixir: [1.18.1]
148+
otp: [27.0]
149+
150+
steps:
151+
- name: Checkout code
152+
uses: actions/checkout@v3
153+
154+
- name: Set up Elixir
155+
uses: erlef/setup-beam@v1
156+
with:
157+
elixir-version: ${{ matrix.elixir }}
158+
otp-version: ${{ matrix.otp }}
159+
160+
- name: Cache Elixir deps
161+
uses: actions/cache@v1
162+
id: deps-cache
163+
with:
164+
path: deps
165+
key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
166+
167+
- name: Cache Elixir _build
168+
uses: actions/cache@v1
169+
id: build-cache
170+
with:
171+
path: _build
172+
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
173+
174+
- name: Install deps
175+
if: steps.deps-cache.outputs.cache-hit != 'true'
176+
run: |
177+
mix local.rebar --force
178+
mix local.hex --force
179+
mix deps.get --only ${{ env.MIX_ENV }}
180+
181+
- name: Compile deps
182+
if: steps.build-cache.outputs.cache-hit != 'true'
183+
run: mix deps.compile --warnings-as-errors
184+
185+
- name: Clean build
186+
run: mix clean
187+
188+
- name: Run tests
189+
run: mix test

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# If the VM crashes, it generates a dump, let's ignore it too.
14+
erl_crash.dump
15+
16+
# Also ignore archive artifacts (built via "mix archive.build").
17+
*.ez
18+
19+
# Ignore package tarball (built via "mix hex.build").
20+
supabase_functions-*.tar
21+
22+
# Temporary files, for example, from tests.
23+
/tmp/
24+
25+
/priv/plts/

.wakatime-project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
functions-ex

CHANGELOG.md

Whitespace-only changes.

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2023 zoedsoupe <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Supabase Functions
2+
3+
[Edge Functions](https://supabase.com/docs/guides/functions) client implementation for the [Supabase Potion](https://github.com/supabase-community/supabase-ex) SDK in Elixir
4+
5+
## Installation
6+
7+
```elixir
8+
def deps do
9+
[
10+
{:supabase_potion, "~> 0.3"},
11+
{:supabase_functions, "~> 0.1"}
12+
]
13+
end
14+
```

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
3+
4+
outputs = {nixpkgs, ...}: let
5+
inherit (nixpkgs.lib) genAttrs;
6+
inherit (nixpkgs.lib.systems) flakeExposed;
7+
forAllSystems = f:
8+
genAttrs flakeExposed (system: f (import nixpkgs {inherit system;}));
9+
in {
10+
devShells = forAllSystems (pkgs: let
11+
inherit (pkgs) mkShell;
12+
inherit (pkgs.beam.interpreters) erlang_27;
13+
inherit (pkgs.beam) packagesWith;
14+
beam = packagesWith erlang_27;
15+
elixir_1_18 = beam.elixir.override {
16+
version = "1.18.2";
17+
18+
src = pkgs.fetchFromGitHub {
19+
owner = "elixir-lang";
20+
repo = "elixir";
21+
rev = "v1.18.2";
22+
sha256 = "sha256-8FhUKAaEjBBcF0etVPdkxMfrnR5niU40U8cxDRJdEok=";
23+
};
24+
};
25+
in {
26+
default = mkShell {
27+
name = "supabase-ex";
28+
packages = with pkgs; [elixir_1_18 postgresql];
29+
};
30+
});
31+
};
32+
}

0 commit comments

Comments
 (0)