-
Notifications
You must be signed in to change notification settings - Fork 10
139 lines (119 loc) · 3.75 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
133
134
135
136
137
138
139
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
name: Python ${{ matrix.python-version }} Tests
services:
postgres:
# Docker Hub image
image: postgres:11
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
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
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
ports:
# Maps port 6379 on service container to the host
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
message-db:
image: ethangarofolo/message-db:1.2.6
ports:
- 5433:5432
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.12.0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install --with dev,test,docs,types --all-extras
if: steps.cache.outputs.cache-hit != 'true'
- name: Tests
run: protean test -c FULL
env:
TEST_CMD: pre-commit run --all-files
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
PGPASSWORD: postgres
# The hostname used to communicate with the Redis service container
REDIS_HOST: localhost
# The default Redis port
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
- name: CodeCOV
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
docs-deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install --only docs
if: steps.cache.outputs.cache-hit != 'true'
- run: mkdocs gh-deploy --force