Skip to content

Commit

Permalink
ci: configure OpenFGA for editoast tests
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Valais <[email protected]>
  • Loading branch information
leovalais committed Feb 21, 2025
1 parent 93e5983 commit 3b89317
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,15 @@ jobs:
--health-interval 5s
--health-timeout 5s
--health-retries 5
openfga:
image: openfga/openfga
env:
OPENFGA_DATASTORE_ENGINE: postgres
OPENFGA_DATASTORE_URI: "postgres://osrd:password@localhost:5432/osrd?search_path=openfga"
OPENFGA_HTTP_ADDR: "localhost:8091"
OPENFGA_PLAYGROUND_ENABLED: false
ports:
- 8091:8091

steps:
- name: Checkout
Expand Down Expand Up @@ -568,6 +577,7 @@ jobs:
# snapshot testing library `insta` requires CI=true
docker run --name=editoast-test --net=host -v $PWD/output:/output \
-e DATABASE_URL="postgres://osrd:password@localhost:5432/osrd" \
-e OPENFGA_HOST="openfga" \
-e CI="true" \
${{ fromJSON(needs.build.outputs.stable_tags).editoast-test }} \
/bin/sh -c "diesel migration run --locked-schema && RUST_BACKTRACE=1 cargo test --workspace --verbose -- --test-threads=4 && grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o /output/lcov.info"
Expand Down
10 changes: 10 additions & 0 deletions editoast/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ RUN rustup component add llvm-tools && \
rustup component add rustfmt && \
rustup component add clippy && \
cargo install grcov

# install `fga` binary used in `crate fga` unit tests
RUN mkdir install \
&& cd install \
&& wget https://github.com/openfga/cli/releases/download/v0.6.4/fga_0.6.4_linux_amd64.tar.gz \
&& tar xf fga_0.6.4_linux_amd64.tar.gz \
&& mv fga /usr/local/bin \
&& cd .. \
&& rm -rf install

COPY --from=planner /editoast/recipe.json recipe.json
COPY --from=planner /editoast/editoast_derive/ editoast_derive
COPY --from=test_data . /tests/data
Expand Down

0 comments on commit 3b89317

Please sign in to comment.