Add CI sanity check
+ compose healthcheck
This commit is contained in:
parent
825a0bc235
commit
9e0b69d23c
@ -1,20 +1,22 @@
|
|||||||
name: Docker Build
|
name: Basic test
|
||||||
|
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
basic-test:
|
||||||
name: Run docker build
|
name: Build and sanity check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Run docker build
|
- name: Build Docker images
|
||||||
run: docker compose build
|
run: docker compose build
|
||||||
test:
|
- name: Run Docker containers
|
||||||
# Add a dummy job to avoid failing GitHub CI checks.
|
run: docker compose up -d
|
||||||
# Other checks to be added later.
|
- name: Check migration version
|
||||||
name: Dummy job
|
timeout-minutes: 1
|
||||||
runs-on: ubuntu-latest
|
run: |
|
||||||
steps:
|
while
|
||||||
- name: Run dummy job
|
version=$(docker compose run --rm migrations version 2>&1 | tail -1 | awk '{print $(NF)}')
|
||||||
run: echo "Empty dummy job"
|
[[ $version != 21 ]]; do
|
||||||
|
echo "Incorrect version: $version"
|
||||||
|
echo "Retrying..."
|
||||||
|
done
|
||||||
|
10
compose.yml
10
compose.yml
@ -2,13 +2,14 @@ services:
|
|||||||
migrations:
|
migrations:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
- ipld-eth-db
|
ipld-eth-db:
|
||||||
|
condition: service_healthy
|
||||||
# Use local build
|
# Use local build
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
# Use an existing image
|
# Use an existing image
|
||||||
image: cerc/ipld-eth-db
|
image: cerc/ipld-eth-db:local
|
||||||
environment:
|
environment:
|
||||||
DATABASE_USER: "vdbm"
|
DATABASE_USER: "vdbm"
|
||||||
DATABASE_NAME: "cerc_testing"
|
DATABASE_NAME: "cerc_testing"
|
||||||
@ -26,3 +27,8 @@ services:
|
|||||||
POSTGRES_PASSWORD: "password"
|
POSTGRES_PASSWORD: "password"
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8077:5432"
|
- "127.0.0.1:8077:5432"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pg_isready", "-U", "vdbm"]
|
||||||
|
interval: 2s
|
||||||
|
timeout: 1s
|
||||||
|
retries: 3
|
||||||
|
Loading…
Reference in New Issue
Block a user