feat: openfga crate (#67) #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: rustfmt | |
toolchain: stable | |
- name: Format | |
run: cargo fmt -- --check | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: clippy | |
toolchain: stable | |
- name: Check clippy | |
run: cargo clippy --tests | |
- name: Check docs | |
run: cargo doc --no-deps | |
unit: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
env: | |
# Disable full debug symbol generation to speed up CI build and keep memory down | |
RUSTFLAGS: -C debuginfo=line-tables-only | |
# Disable incremental builds by cargo for CI which should save disk space | |
# and hopefully avoid final link "No space left on device" | |
CARGO_INCREMENTAL: 0 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run unit tests | |
run: cargo test --lib | |
policy: | |
name: OpenFGA model tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run model tests | |
uses: openfga/[email protected] | |
with: | |
store-file-path: ./delta-sharing/openfga/fga/dev.fga.yaml | |
- name: Install OpenFGA server | |
uses: jaxxstorm/[email protected] | |
with: | |
repo: openfga/openfga | |
tag: v1.8.0 | |
cache: enable | |
- name: Start OpenFGA server in background | |
shell: bash | |
run: openfga run & | |
- name: Run openfga create tests | |
run: | | |
export FGA_STORE_ID="$(fga store import --file ./delta-sharing/openfga/fga/dev.fga.yaml | jq -r .store.id)" | |
cargo test -p delta-sharing-openfga | |
integration: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:alpine | |
env: | |
POSTGRES_DB: sharing | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: secret | |
ports: | |
- 5432:5432 | |
env: | |
# Disable full debug symbol generation to speed up CI build and keep memory down | |
RUSTFLAGS: -C debuginfo=line-tables-only | |
# Disable incremental builds by cargo for CI which should save disk space | |
# and hopefully avoid final link "No space left on device" | |
CARGO_INCREMENTAL: 0 | |
DATABASE_URL: postgres://postgres:[email protected]:5432/sharing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run integration tests | |
run: cargo test --tests |