Add CI sanity check
+ compose healthcheck
This commit is contained in:
parent
60e83a1e2c
commit
5661187a32
@ -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
|
||||
|
10
compose.yml
10
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
|
||||
|
Loading…
Reference in New Issue
Block a user