-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (102 loc) · 3.28 KB
/
ci.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI
env:
PYTHON_VERSION: '3.12'
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-plugin:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
services:
postgres:
image: postgres:13
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Setup and Activate virtualenv
run: |
uv venv venv --python ${{ env.PYTHON_VERSION }}
source venv/bin/activate
echo "VIRTUAL_ENV=$(pwd)/venv" >> $GITHUB_ENV
echo "$(pwd)/venv/bin" >> $GITHUB_PATH
- name: Install system dependencies
run: sudo apt-get install postgresql-client libpq-dev redis-server
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Install Indico
run: |
uv pip install -U pip setuptools wheel
uv pip install Babel
uv pip install "indico[dev] @ git+https://github.com/indico/indico.git"
# - name: Install node dependencies
# run: npm ci
- name: Install plugin
run: |
uv pip install -e .
- name: Setup database
run: |
export PGHOST=localhost
export PGPORT=${{ job.services.postgres.ports[5432] }}
export PGUSER=postgres
createuser indicotest
createdb -O indicotest indicotest
psql indicotest -c 'CREATE EXTENSION unaccent;'
psql indicotest -c 'CREATE EXTENSION pg_trgm;'
- name: Run tests
run: |
export INDICO_TEST_DATABASE_URI="postgresql://indicotest@localhost:${{ job.services.postgres.ports[5432] }}/indicotest"
pytest tests/ --color=yes
lint:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Setup and Activate virtualenv
run: |
uv venv venv --python ${{ env.PYTHON_VERSION }}
source venv/bin/activate
echo "VIRTUAL_ENV=$(pwd)/venv" >> $GITHUB_ENV
echo "$(pwd)/venv/bin" >> $GITHUB_PATH
- name: Install system dependencies
run: sudo apt-get install postgresql-client libpq-dev redis-server
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Install Indico
run: |
uv pip install -U pip setuptools wheel
uv pip install Babel isort ruff
uv pip install "indico[dev] @ git+https://github.com/indico/indico.git"
# - name: Install node dependencies
# run: npm ci
- name: Check import sorting
if: success() || failure()
run: isort --diff --check-only .
- name: Run ruff
if: success() || failure()
run: |
ruff check --output-format github .