]> git.openstreetmap.org Git - nominatim.git/blob - .github/actions/setup-postgresql/action.yml
remove special casing for legacy tokenizer from BDD tests
[nominatim.git] / .github / actions / setup-postgresql / action.yml
1 name: 'Setup Postgresql and Postgis'
2
3 inputs:
4     postgresql-version:
5         description: 'Version of PostgreSQL to install'
6         required: true
7     postgis-version:
8         description: 'Version of Postgis to install'
9         required: true
10
11 runs:
12     using: "composite"
13
14     steps:
15         - name: Remove existing PostgreSQL
16           run: |
17               sudo apt-get purge -yq postgresql*
18               sudo apt install curl ca-certificates gnupg
19               curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
20               sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
21               sudo apt-get update -qq
22
23           shell: bash
24
25         - name: Install PostgreSQL
26           run: |
27               sudo apt-get install -y -qq --no-install-suggests --no-install-recommends postgresql-client-${PGVER} postgresql-${PGVER}-postgis-${POSTGISVER} postgresql-${PGVER}-postgis-${POSTGISVER}-scripts postgresql-contrib-${PGVER} postgresql-${PGVER}
28           shell: bash
29           env:
30               PGVER: ${{ inputs.postgresql-version }}
31               POSTGISVER: ${{ inputs.postgis-version }}
32
33         - name: Adapt postgresql configuration
34           run: |
35               echo 'fsync = off' | sudo tee /etc/postgresql/${PGVER}/main/conf.d/local.conf
36               echo 'synchronous_commit = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
37               echo 'full_page_writes = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
38               echo 'shared_buffers = 1GB' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
39               echo 'port = 5432' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
40           shell: bash
41           env:
42               PGVER: ${{ inputs.postgresql-version }}
43
44         - name: Setup database
45           run: |
46               sudo systemctl restart postgresql
47               sudo -u postgres createuser -S www-data
48               sudo -u postgres createuser -s runner
49           shell: bash