diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1491465383e..32753a47ef6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -517,31 +517,6 @@ jobs: name: Check editoast tests needs: - build - - services: - postgres: - image: postgis/postgis - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - valkey: - image: valkey/valkey - ports: - - 6379:6379 - options: >- - --health-cmd "valkey-cli ping" - --health-interval 5s - --health-timeout 5s - --health-retries 5 - steps: - name: Checkout uses: actions/checkout@v4 @@ -558,13 +533,21 @@ jobs: run: | docker load --input ./osrd-editoast-test.tar - - name: Execute tests within container + - name: Startup the test infrastructure + id: start_editoast_tests_infra run: | - docker run --rm --net=host \ - -v $PWD/docker/init_db.sql:/init_db.sql \ - postgis/postgis:latest \ - psql postgresql://postgres:password@localhost:5432 -f /init_db.sql + set -e + + services='valkey openfga' + composes='-f docker-compose.yml' + docker compose $composes pull --policy missing $services + docker compose $composes up --no-build -d $services + env: + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + - name: Execute tests within container + run: | # 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" \ diff --git a/editoast/Dockerfile b/editoast/Dockerfile index 2b399be2e28..5a8c1bddbc4 100644 --- a/editoast/Dockerfile +++ b/editoast/Dockerfile @@ -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