Skip to content
Open
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
116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
setup:
name: Setup for Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
runs-on: ubuntu-latest
strategy: &strategy
matrix:
elixir: ["1.15", "1.16", "1.17", "1.18", "1.19"]
otp: ["25", "26", "27", "28"]
# see https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
exclude:
[
{ elixir: 1.15, otp: 27 },
{ elixir: 1.15, otp: 28 },
{ elixir: 1.16, otp: 27 },
{ elixir: 1.16, otp: 28 },
{ elixir: 1.17, otp: 28 },
{ elixir: 1.19, otp: 25 },
]
steps:
- &checkout
name: Checkout
uses: actions/checkout@v4

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

- &cache
name: Restore deps cache
uses: actions/cache@v4
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
restore-keys: |
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}

- name: Install package dependencies
run: mix deps.get

- name: Compile dependencies
run: mix compile
env:
MIX_ENV: ${{ inputs.mix_env }}

test:
name: Test on Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
runs-on: ubuntu-latest
needs: [setup]
strategy: *strategy
steps:
- *checkout
- *setup
- *cache
- name: Run unit tests
run: mix test

dependencies:
name: Check dependencies
runs-on: ubuntu-latest
needs: [setup]
strategy:
matrix: { elixir: ["1.19"], otp: ["28"] }
steps:
- *checkout
- name: Set up Elixir
uses: erlef/setup-beam@v1
with: { elixir-version: 1.19, otp-version: 28 }
- *cache
- name: Check for unused dependencies
run: mix deps.unlock --check-unused
- name: Check for retired dependencies
run: mix hex.audit
- name: Check for dependencies for known vulnerabilities
run: mix hex.audit

format:
name: Check formatting
runs-on: ubuntu-latest
needs: [setup]
strategy:
matrix: { elixir: ["1.19"], otp: ["28"] }
steps:
- *checkout
- name: Set up Elixir
uses: erlef/setup-beam@v1
with: { elixir-version: 1.19, otp-version: 28 }
- *cache
- name: Check code format
run: mix format --check-formatted

release:
name: Create or Update Release PR
runs-on: ubuntu-latest
needs: [test, dependencies, format]
if: github.ref == 'refs/heads/main'
permissions:
contents: write
pull-requests: write
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.REPO_GITHUB_TOKEN }}
release-type: elixir
16 changes: 16 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Validate PR Title

on:
pull_request_target:
types: [opened, synchronize, edited, reopened]

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Hex Package

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "The git tag for the release to publish"
type: string
required: true

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || github.ref }}

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

- name: Restore deps cache
uses: actions/cache@v4
with:
path: |
deps
_build
key: deps-${{ runner.os }}-28-1.19-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
restore-keys: |
deps-${{ runner.os }}-28.1.19-${{ hashFiles('**/mix.lock') }}
deps-${{ runner.os }}-28-1.19-${{ matrix.otp }}-${{ matrix.elixir }}

- name: Publish to hex.pm
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --yes
63 changes: 0 additions & 63 deletions .github/workflows/test.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.6.0](https://github.com/absinthe-graphql/absinthe_relay/compare/v1.5.2...v1.6.0) (2025-11-06)

### Miscellaneous Chores

* release 1.6.0 ([4174c0a](https://github.com/absinthe-graphql/absinthe_relay/commit/4174c0a83bea8d0fa5e3034f379acb203e01b805))
* update minimum elixir version
* update absinthe dependency mininum version

## 1.4.4 - 2018-09-20

- Feature: Enhancements to Connection macros to support extensibility of edge types. See [PR #109](https://github.com/absinthe-graphql/absinthe_relay/pull/109) (Thanks, @coderdan!)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Make your change. Add tests for your change. Make the tests pass:
Push to your fork (preferably to a non-`master` branch) and
[submit a pull request][pr].

[pr]: https://github.com/absinthe-graphql/absinthe_relay/compare/
Ensure your pull request title follows [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) specification.

We'll review and answer your pull request as soon as possible. We may suggest
some changes, improvements, or alternatives. Let's work through it together.
Expand Down
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,49 @@ Relay supports mutation via [a contract](https://facebook.github.io/relay/docs/e

See the [Absinthe.Relay.Mutation](https://hexdocs.pm/absinthe_relay/Absinthe.Relay.Mutation.html) module documentation for specific instructions on how to design a schema that makes use of mutations.

### Incremental Delivery

Absinthe.Relay supports GraphQL `@defer` and `@stream` directives for incremental delivery with Relay connections. This enables streaming of connection edges while maintaining proper cursor consistency and connection structure.

Key features:
- ✅ **Relay Specification**: Full compliance with Relay Cursor Connection spec
- ✅ **Cursor Consistency**: Maintains proper cursor ordering during streaming
- ✅ **Connection Structure**: Preserves `pageInfo` and connection metadata
- ✅ **Bidirectional Pagination**: Supports forward and backward streaming

**Installation with incremental delivery:**

```elixir
def deps do
[
{:absinthe, git: "https://github.com/gigsmart/absinthe.git", branch: "gigmart/defer-stream-incremental"},
{:absinthe_relay, git: "https://github.com/gigsmart/absinthe_relay.git", branch: "gigmart/defer-stream-incremental"}
]
end
```

**Example usage:**

```graphql
query GetPosts($first: Int!, $after: String) {
posts(first: $first, after: $after) @stream(initialCount: 2, label: "posts") {
pageInfo {
hasNextPage
endCursor
}
edges {
cursor
node {
id
title
}
}
}
}
```

For comprehensive documentation on Relay incremental delivery patterns, see [Absinthe Incremental Delivery Guide](https://hexdocs.pm/absinthe/incremental-delivery.html).

## Supporting the Babel Relay Plugin

To generate a `schema.json` file for use with the [Babel Relay Plugin](https://facebook.github.io/relay/docs/en/installation-and-setup.html#set-up-babel-plugin-relay), run the `absinthe.schema.json` Mix task, built-in to [Absinthe](https://github.com/absinthe-graphql/absinthe).
Expand Down
Loading
Loading