Skip to content

Commit f5c7803

Browse files
committed
refactor: follow storage-js (#4)
1 parent 90ad694 commit f5c7803

26 files changed

+1334
-1099
lines changed

.dialyzerignore

Whitespace-only changes.

.github/workflows/ci.yml

Lines changed: 152 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414

15+
env:
16+
MIX_ENV: test
17+
1518
strategy:
1619
matrix:
17-
elixir: [1.17.0]
20+
elixir: [1.18.1]
1821
otp: [27.0]
1922

2023
steps:
@@ -27,8 +30,30 @@ jobs:
2730
elixir-version: ${{ matrix.elixir }}
2831
otp-version: ${{ matrix.otp }}
2932

30-
- name: Install dependencies
31-
run: mix deps.get
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
3257

3358
- name: Clean build
3459
run: mix clean
@@ -38,3 +63,127 @@ jobs:
3863

3964
- name: Run Credo
4065
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

.github/workflows/release.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ result
3838

3939
/.elixir_ls/
4040
/.elixir-tools/
41+
42+
/priv/plts/

.wakatime-project

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
```elixir
88
def deps do
99
[
10-
{:supabase_potion, "~> 0.5"},
11-
{:supabase_storage, "~> 0.3"}
10+
{:supabase_potion, "~> 0.6"},
11+
{:supabase_storage, "~> 0.4"}
1212
]
1313
end
1414
```

0 commit comments

Comments
 (0)