-
Notifications
You must be signed in to change notification settings - Fork 62
53 lines (51 loc) · 2.14 KB
/
test.yml
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
name: Test
on:
push: {}
pull_request: {}
workflow_dispatch: {}
schedule:
- cron: '30 06 * * *'
jobs:
test:
name: Run tests and linters
runs-on: ubuntu-24.04
env:
LANG: en_US.utf8
DEBIAN_FRONTEND: noninteractive
PG_MAJOR: 17
container:
image: ubuntu:noble
steps:
- uses: actions/checkout@v4
- name: Set locale to utf-8
run: |
apt-get update
apt-get install -y ca-certificates locales
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
- name: Install wget
run: |
apt-get install -y wget
rm -rf /var/lib/apt/lists/*
- name: Check for spelling typos
uses: crate-ci/typos@master
- name: Set postgresql uid/gid
run: |
groupadd -r postgres --gid=999
useradd -r -d /var/lib/postgresql -g postgres --uid=999 postgres
- name: Install PostgreSQL ${PG_MAJOR} and Python
run: |
echo 'deb http://apt.postgresql.org/pub/repos/apt/ noble-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
echo 'deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu/ noble main' > /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa.list
apt-get -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true update
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o APT::Get::AllowUnauthenticated=true install -y postgresql-common sudo libpq-dev python3.11-dev python3.11-lib2to3 build-essential curl postgresql-$PG_MAJOR postgresql-contrib-$PG_MAJOR
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.11 get-pip.py
pip3.11 install tox
- name: Start PostgreSQL
run: |
chown -R postgres:postgres .
mkdir -p /var/log/postgresql
chown postgres:postgres /var/log/postgresql
sudo -u postgres /usr/lib/postgresql/${PG_MAJOR}/bin/pg_ctl -D /etc/postgresql/${PG_MAJOR}/main -l /var/log/postgresql/postgresql-${PG_MAJOR}-main.log start
- name: Run tox
run: sudo -u postgres tox