fix postgres service #16
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
| # yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/github-workflow.json | |
| name: Run with Postgres | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Docker | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Run Postgres | |
| run: | | |
| docker run -v /tmp/postgres_logs:/var/log/postgresql -e POSTGRES_PASSWORD=123 -e POSTGRES_DB=testing --name postgres -p 5432:5432 -d postgres:18beta1-alpine postgres -c shared_preload_libraries=auto_explain -c auto_explain.log_min_duration=0 -c auto_explain.log_analyze=true -c auto_explain.log_verbose=true -c auto_explain.log_buffers=true -c auto_explain.log_format=json -c logging_collector=on -c log_directory='/var/log/postgresql' -c log_filename='postgres.log' | |
| - name: List networks | |
| run: docker container inspect postgres | |
| # - name: Wait for Postgres | |
| # run: | | |
| # pg_isready -h localhost -U postgres; | |
| - name: Apply SQL file | |
| run: | | |
| psql -h 127.0.0.1 -U postgres -d testing -f bootstrap.sql | |
| env: | |
| PGPASSWORD: 123 | |
| - name: Copy Postgres logs | |
| run: | | |
| docker cp postgres:/var/log/postgresql/postgres.log /tmp/postgres.log | |
| - name: Run local GitHub Action | |
| uses: ./Dockerfile | |
| with: | |
| POSTGRES_URL: http://postgres:123@postgres:5432/testing | |
| log-path: /tmp/postgres.log |