Skip to content

Commit

Permalink
release: v0.6.0 (#49)
Browse files Browse the repository at this point in the history
## Problem

The project currently uses an outdated version of Elixir, which may lack
recent features and improvements introduced in newer releases. Upgrading
to a more recent version can enhance performance, security, and
maintainability.

## Solution

This pull request updates the project's Elixir version to 1.18. This
version introduces several enhancements, including:

- **Type System Improvements**: Elixir 1.18 introduces type checking of
function calls and gradual inference of patterns and return types,
enhancing code reliability.

- **Language Server Enhancements**: The new compiler lock and listener
features improve development tooling by allowing multiple Elixir
instances to share compilation results, reducing duplicate efforts.

- **Built-in JSON Support**: A new `JSON` module provides functions to
encode and decode JSON, streamlining data handling without external
dependencies.

- **ExUnit Enhancements**: Support for parameterized tests allows
running the same test module multiple times under different parameters,
improving test coverage and flexibility.

## Rationale

Upgrading to Elixir 1.18 ensures the project benefits from the latest
language features and performance improvements. The enhancements in type
checking, development tooling, and testing capabilities contribute to a
more robust and efficient codebase. Additionally, built-in JSON support
reduces reliance on external libraries, simplifying maintenance.

For a comprehensive overview of the new features in Elixir 1.18, you
might find the following video informative:
  • Loading branch information
zoedsoupe authored Jan 14, 2025
1 parent b7bfe78 commit bbfd034
Show file tree
Hide file tree
Showing 41 changed files with 2,517 additions and 817 deletions.
Empty file added .dialyzerignore
Empty file.
27 changes: 0 additions & 27 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,3 @@ export ERL_AFLAGS="-kernel shell_history enabled"
export LANG=en_US.UTF-8

use flake

# Setup postgresql
if test -d "/Applications/Postgres.app"; then
export DATABASE_USER="$(whoami)"
export DATABASE_PASSWORD=""
else
# postges related
export DATABASE_USER="supabase_potion"
export DATABASE_PASSWORD="supabase_potion"
export PG_DATABASE="supabase_potion_dev"
# keep all your db data in a folder inside the project
export PGHOST="$PWD/.postgres"
export PGDATA="$PGHOST/data"
export PGLOG="$PGHOST/server.log"

if [[ ! -d "$PGDATA" ]]; then
# initital set up of database server
initdb --auth=trust --no-locale --encoding=UTF8 -U=$DATABASE_USER >/dev/null

# point to correct unix sockets
echo "unix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
# creates loacl database user
echo "CREATE USER $DATABASE_USER SUPERUSER;" | postgres --single -E postgres
# creates local databse
echo "CREATE DATABASE $PG_DATABASE;" | postgres --single -E postgres
fi
fi
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,apps}/**/*.{ex,exs}"]
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
155 changes: 152 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ jobs:
lint:
runs-on: ubuntu-latest

env:
MIX_ENV: test

strategy:
matrix:
elixir: [1.17.0]
elixir: [1.18.1]
otp: [27.0]

steps:
Expand All @@ -27,8 +30,30 @@ jobs:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}

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

- name: Cache Elixir _build
uses: actions/cache@v1
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ 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 --only ${{ env.MIX_ENV }}
- name: Compile deps
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile --warnings-as-errors

- name: Clean build
run: mix clean
Expand All @@ -38,3 +63,127 @@ jobs:

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

static-analisys:
runs-on: ubuntu-latest

env:
MIX_ENV: test

strategy:
matrix:
elixir: [1.18.1]
otp: [27.0]

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

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

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

- name: Cache Elixir _build
uses: actions/cache@v1
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ 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 --only ${{ env.MIX_ENV }}
- name: Compile deps
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
id: plt_cache
with:
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
restore-keys: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt
path: priv/plts

# 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

test:
runs-on: ubuntu-latest

env:
MIX_ENV: test

strategy:
matrix:
elixir: [1.18.1]
otp: [27.0]

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

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

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

- name: Cache Elixir _build
uses: actions/cache@v1
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ 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 --only ${{ env.MIX_ENV }}
- name: Compile deps
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile --warnings-as-errors

- name: Clean build
run: mix clean

- name: Run tests
run: mix test
30 changes: 0 additions & 30 deletions .github/workflows/release.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ result
# Nix files
result

# LSP files
.elixir_ls/
.elixir-tools/
.lexical/

# Dialyzer
/priv/plts/
140 changes: 140 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Changelog

All notable changes to this project are documented in this file.

## [0.6.0] - 2025-01-10
### Added
- Enhanced HTTP handling with support for custom headers, streaming, and centralized error management.
- Improved test coverage and added dependency `mox` for mocking.
- CI/CD pipeline improvements with caching for faster builds.

### Fixed
- Resolved header merging issues and inconsistencies in JSON error handling.

### Removed
- Dropped `manage_clients` option; explicit OTP management required.

### Issues
- Fixed "[Fetcher] Extract error parsing to its own module" [#23](https://github.com/supabase-community/supabase-ex/issues/23)
- Fixed "Unable to pass `auth` key inside options to `init_client`" [#45](https://github.com/supabase-community/supabase-ex/issues/45)
- Fixed "Proposal to refactor and simplify the `Supabase.Fetcher` module" [#51](https://github.com/supabase-community/supabase-ex/issues/51)
- Fixed "Invalid Unicode error during file uploads (affets `storage-ex`)" [#52](https://github.com/supabase-community/supabase-ex/issues/52)

---

## [0.5.1] - 2024-09-21
### Added
- Improved error handling for HTTP fetch operations.
- Added optional retry policies for idempotent requests.

### Fixed
- Resolved race conditions in streaming functionality.

---

## [0.5.0] - 2024-09-21
### Added
- Support for direct file uploads to cloud storage.
- Enhanced real-time subscription management.

### Fixed
- Corrected WebSocket reconnection logic under high load.

---

## [0.4.1] - 2024-08-30
### Changed
- Performance optimizations in JSON encoding and decoding.
- Improved logging for debugging.

### Fixed
- Addressed memory leaks in connection pooling.

---

## [0.4.0] - 2024-08-30
### Added
- Introduced WebSocket monitoring tools.
- Support for encrypted token storage.

---

## [0.3.7] - 2024-05-14
### Added
- Initial implementation of streaming API for large datasets.

### Fixed
- Bug fixes in the pagination logic.

---

## [0.3.6] - 2024-04-28
### Added
- Experimental support for Ecto integration.

---

## [0.3.5] - 2024-04-21
### Fixed
- Addressed intermittent crashes when initializing connections.

---

## [0.3.4] - 2024-04-21
### Changed
- Optimized internal handling of database transactions.

---

## [0.3.3] - 2024-04-21
### Added
- Support for preflight HTTP requests.

---

## [0.3.2] - 2024-04-16
### Fixed
- Resolved issues with JSON payload validation.

---

## [0.3.1] - 2024-04-15
### Fixed
- Resolved inconsistent query results in edge cases.

---

## [0.3.0] - 2023-11-20
### Added
- Major refactor introducing modular architecture.
- Support for real-time database change notifications.

---

## [0.2.3] - 2023-10-11
### Fixed
- Patched security vulnerabilities in session handling.

---

## [0.2.2] - 2023-10-10
### Added
- Middleware support for request customization.

---

## [0.2.1] - 2023-10-10
### Fixed
- Corrected behavior for long-lived connections.

---

## [0.2.0] - 2023-10-05
### Added
- Initial implementation of role-based access control.

---

## [0.1.0] - 2023-09-18
### Added
- Initial release with core features: database access, authentication, and storage support.
Loading

0 comments on commit bbfd034

Please sign in to comment.