|
| 1 | +name: PostgreSQL tests |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + |
| 5 | +jobs: |
| 6 | + # Label of the container job |
| 7 | + container-job: |
| 8 | + # Containers must run in Linux based operating systems |
| 9 | + runs-on: ubuntu-latest |
| 10 | + # Docker Hub image that `container-job` executes in |
| 11 | + container: node:10.18-jessie |
| 12 | + |
| 13 | + # Service containers to run with `container-job` |
| 14 | + services: |
| 15 | + # Label used to access the service container |
| 16 | + postgres: |
| 17 | + # Docker Hub image |
| 18 | + image: pyramation/postgis |
| 19 | + # Provide the password for postgres |
| 20 | + env: |
| 21 | + POSTGRES_USER: postgres |
| 22 | + POSTGRES_PASSWORD: password |
| 23 | + # Set health checks to wait until postgres has started |
| 24 | + options: >- |
| 25 | + --health-cmd pg_isready |
| 26 | + --health-interval 10s |
| 27 | + --health-timeout 5s |
| 28 | + --health-retries 5 |
| 29 | +
|
| 30 | + steps: |
| 31 | + # Downloads a copy of the code in your repository before running CI tests |
| 32 | + - name: Check out repository code |
| 33 | + uses: actions/checkout@v3 |
| 34 | + |
| 35 | + # Performs a clean installation of all dependencies in the `package.json` file |
| 36 | + # For more information, see https://docs.npmjs.com/cli/ci.html |
| 37 | + - name: Install dependencies |
| 38 | + run: npm ci |
| 39 | + |
| 40 | + - name: Connect to PostgreSQL |
| 41 | + # Runs a script that creates a PostgreSQL table, populates |
| 42 | + # the table with data, and then retrieves the data. |
| 43 | + run: node client.js |
| 44 | + # Environment variables used by the `client.js` script to create a new PostgreSQL table. |
| 45 | + env: |
| 46 | + # The hostname used to communicate with the PostgreSQL service container |
| 47 | + POSTGRES_HOST: postgres |
| 48 | + # The default PostgreSQL port |
| 49 | + POSTGRES_PORT: 5432 |
0 commit comments