Avoid rerunning CI workflows when it's not necessary #1889
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Electric Docker Image Smoke Test | |
| on: | |
| push: | |
| branches: ['main'] | |
| paths-ignore: | |
| - 'website/**' | |
| - '**/README.md' | |
| - 'integration-tests/**' | |
| pull_request: | |
| paths-ignore: | |
| - 'website/**' | |
| - '**/README.md' | |
| - 'integration-tests/**' | |
| jobs: | |
| docker_image_smoketest: | |
| name: Docker image smoke test | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: 'postgres:17-alpine' | |
| env: | |
| POSTGRES_PASSWORD: password | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: 'Set PG settings' | |
| run: | | |
| docker exec ${{ job.services.postgres.id }} sh -c 'echo "wal_level=logical" >> /var/lib/postgresql/data/postgresql.conf' | |
| docker restart ${{ job.services.postgres.id }} | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: actions/checkout@v4 | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: packages/sync-service | |
| build-contexts: | | |
| electric-telemetry=packages/electric-telemetry | |
| push: false | |
| load: true | |
| tags: 'electric-test-image' | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: 'Run the built image' | |
| run: | | |
| docker run \ | |
| --rm \ | |
| --net host \ | |
| --name electric \ | |
| -e ELECTRIC_USAGE_REPORTING=false \ | |
| -e ELECTRIC_INSECURE=true \ | |
| -e DATABASE_URL='postgresql://postgres:password@localhost:5432?sslmode=disable' \ | |
| -d \ | |
| electric-test-image | |
| - name: Wait for the container to reach healthy status | |
| uses: stringbean/docker-healthcheck-action@v3 | |
| with: | |
| container: electric | |
| require-status: running | |
| require-healthy: true | |
| wait-time: 20 | |
| - name: Dump container logs | |
| run: docker logs electric |