diff --git a/.gitea/workflows/on-pr.yaml b/.gitea/workflows/on-pr.yaml index 6278c52..0949d02 100644 --- a/.gitea/workflows/on-pr.yaml +++ b/.gitea/workflows/on-pr.yaml @@ -1,20 +1,22 @@ -name: Docker Build - +name: Basic test on: [pull_request] jobs: - build: - name: Run docker build + basic-test: + name: Build and sanity check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Run docker build + - uses: actions/checkout@v4 + - name: Build Docker images run: docker compose build - test: - # Add a dummy job to avoid failing GitHub CI checks. - # Other checks to be added later. - name: Dummy job - runs-on: ubuntu-latest - steps: - - name: Run dummy job - run: echo "Empty dummy job" + - name: Run Docker containers + run: docker compose up -d + - name: Check migration version + timeout-minutes: 1 + run: | + while + version=$(docker compose run --rm migrations version 2>&1 | tail -1 | awk '{print $(NF)}') + [[ $version != 21 ]]; do + echo "Incorrect version: $version" + echo "Retrying..." + done diff --git a/compose.yml b/compose.yml index 2849e33..8caf840 100644 --- a/compose.yml +++ b/compose.yml @@ -2,13 +2,14 @@ services: migrations: restart: on-failure depends_on: - - ipld-eth-db + ipld-eth-db: + condition: service_healthy # Use local build build: context: . dockerfile: Dockerfile # Use an existing image - image: cerc/ipld-eth-db + image: cerc/ipld-eth-db:local environment: DATABASE_USER: "vdbm" DATABASE_NAME: "cerc_testing" @@ -26,3 +27,8 @@ services: POSTGRES_PASSWORD: "password" ports: - "127.0.0.1:8077:5432" + healthcheck: + test: ["CMD", "pg_isready", "-U", "vdbm"] + interval: 2s + timeout: 1s + retries: 3