summaryrefslogtreecommitdiffstats
path: root/.github/workflows/packages-pool.yml
blob: e9624e7dd4909a7a8988b41d01cc9a8ade661c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build pool packages

on:
  workflow_dispatch:
  schedule:
    - cron: '28 6 * * sun'

jobs:

  sdist:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        include:
          - {package: psycopg_pool, format: sdist, impl: python}
          - {package: psycopg_pool, format: wheel, impl: python}

    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-python@v4
        with:
          python-version: 3.9

      - name: Create the sdist packages
        run: |-
          python ${{ matrix.package }}/setup.py sdist -d `pwd`/dist/
        if: ${{ matrix.format == 'sdist' }}

      - name: Create the wheel packages
        run: |-
          pip install wheel
          python ${{ matrix.package }}/setup.py bdist_wheel -d `pwd`/dist/
        if: ${{ matrix.format == 'wheel' }}

      - name: Install the Python pool package and test requirements
        run: |-
          pip install dist/*
          pip install ./psycopg[test]

      - name: Test the sdist package
        run: pytest -m 'not slow and not flakey' --color yes
        env:
          PSYCOPG_IMPL: ${{ matrix.impl }}
          PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
          PGPASSWORD: password

      - uses: actions/upload-artifact@v3
        with:
          path: ./dist/*

    services:
      postgresql:
        image: postgres:14
        env:
          POSTGRES_PASSWORD: password
        ports:
          - 5432:5432
        # Set health checks to wait until postgres has started
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5