Skip to content

Commit

Permalink
Do not encode json request body (#6)
Browse files Browse the repository at this point in the history
* upgrade: simplify nix flake and update elixir

* init a dev sample app

* fix: do not encode request body\n\nand also correctly handle media types headers

* update ci
  • Loading branch information
zoedsoupe authored Dec 29, 2024
1 parent e1e2d74 commit f048c64
Show file tree
Hide file tree
Showing 12 changed files with 471 additions and 193 deletions.
3 changes: 0 additions & 3 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ export ERL_AFLAGS="-kernel shell_history enabled"
export LANG=en_US.UTF-8

use flake

# get supabase real keys
source .env
30 changes: 26 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:

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

steps:
- name: Checkout code
Expand All @@ -27,8 +27,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 Down
30 changes: 0 additions & 30 deletions .github/workflows/release.yml

This file was deleted.

63 changes: 5 additions & 58 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 33 additions & 36 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
{
description = "Supabase SDK for Elixir";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
};
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";

outputs = {nixpkgs, ...}: let
inherit (nixpkgs.lib) genAttrs;
inherit (nixpkgs.lib.systems) flakeExposed;
forAllSystems = f:
genAttrs flakeExposed (system: f (import nixpkgs {inherit system;}));
in {
devShells = forAllSystems (pkgs: let
inherit (pkgs) mkShell;
inherit (pkgs.beam.interpreters) erlang_27;
inherit (pkgs.beam) packagesWith;
beam = packagesWith erlang_27;
elixir_1_18 = beam.elixir.override {
version = "1.18.1";

outputs = {
flake-parts,
systems,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import systems;
perSystem = {
pkgs,
system,
...
}: let
inherit (pkgs.beam.interpreters) erlang_27;
inherit (pkgs.beam) packagesWith;
beam = packagesWith erlang_27;
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
src = pkgs.fetchFromGitHub {
owner = "elixir-lang";
repo = "elixir";
rev = "v1.18.1";
sha256 = "sha256-zJNAoyqSj/KdJ1Cqau90QCJihjwHA+HO7nnD1Ugd768=";
};
devShells.default = with pkgs;
mkShell {
name = "postgrest-ex";
packages = with pkgs;
[beam.elixir_1_17]
++ lib.optional stdenv.isLinux [inotify-tools]
++ lib.optional stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
];
};
};
};
in {
default = mkShell {
name = "postgrest-ex";
packages = with pkgs;
[elixir_1_18 postgresql]
++ lib.optional stdenv.isLinux [inotify-tools]
++ lib.optional stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
];
};
});
};
}
Loading

0 comments on commit f048c64

Please sign in to comment.