-
Notifications
You must be signed in to change notification settings - Fork 13
179 lines (152 loc) · 7.13 KB
/
ci.yaml
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build and Test OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
runs-on: ubuntu-latest
strategy:
matrix:
otp: [25]
elixir: [1.15]
env:
MIX_ENV: test
ImageOS: ubuntu20
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Install and Configure Postgres on Port 5232
run: |
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib
sudo service postgresql start
# Set the password for the 'postgres' user to 'postgres'
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';"
# Allow password authentication (uncomment in pg_hba.conf)
sudo sed -i "s/^#host all all 127.0.0.1\/32 md5/host all all 127.0.0.1\/32 md5/" /etc/postgresql/*/main/pg_hba.conf
sudo sed -i "s/^#host all all ::1\/128 md5/host all all ::1\/128 md5/" /etc/postgresql/*/main/pg_hba.conf
# Increase max_connections in postgresql.conf
POSTGRESQL_CONF=$(find /etc/postgresql -name postgresql.conf)
echo "postgresql.conf located at: $POSTGRESQL_CONF"
sudo sed -i "s/^#max_connections = [0-9]*/max_connections = 1000/" $POSTGRESQL_CONF
# Restart PostgreSQL to apply changes
sudo service postgresql restart
# Create the database
sudo -u postgres psql -c "CREATE DATABASE \"eigr-functions-db\";"
- name: Verify max_connections
run: |
PGPASSWORD=postgres psql -U postgres -d eigr-functions-db -h localhost -c "SHOW max_connections;"
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop
# - name: Set up MariaDB
# uses: getong/[email protected]
# with:
# host port: 3307
# container port: 3307
# character set server: 'utf8'
# collation server: 'utf8_general_ci'
# mariadb version: '10.4.10'
# mysql database: 'eigr-functions-db'
#
# - name: Wait for MariaDB to be Ready
# run: |
# for i in {1..10}; do
# if mysqladmin ping -h127.0.0.1 -P3307 --silent; then
# echo "MariaDB is ready!"
# break
# fi
# echo "Waiting for MariaDB..."
# sleep 5
# done
#
# - name: Set up MariaDB User
# run: |
# # Create 'admin' user with password 'admin' and grant privileges
# mysql -h127.0.0.1 -P3307 -uroot -e "CREATE USER IF NOT EXISTS 'admin'@'%' IDENTIFIED BY 'admin';"
# mysql -h127.0.0.1 -P3307 -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;"
# mysql -h127.0.0.1 -P3307 -uroot -e "FLUSH PRIVILEGES;"
- name: Install NATS with JetStream
run: |
wget https://github.com/nats-io/nats-server/releases/download/v2.10.0/nats-server-v2.10.0-linux-amd64.tar.gz
tar -xvzf nats-server-v2.10.0-linux-amd64.tar.gz
sudo mv nats-server-v2.10.0-linux-amd64/nats-server /usr/local/bin/
nats-server --jetstream &
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
otp-version: ${{matrix.otp}} # Define the OTP version [required]
- uses: actions/cache@v1
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- uses: actions/cache@v1
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install dependencies
run: |
mix deps.clean --all
mix deps.get
- name: Run tests spawn
run: |
MIX_ENV=test PROXY_DATABASE_TYPE=native SPAWN_SUPERVISORS_STATE_HANDOFF_CONTROLLER=nats SPAWN_USE_INTERNAL_NATS=true SPAWN_PUBSUB_ADAPTER=nats PROXY_CLUSTER_STRATEGY=gossip PROXY_DATABASE_POOL_SIZE=15 PROXY_HTTP_PORT=9005 SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
- name: Run tests spawn_sdk
run: |
cd spawn_sdk/spawn_sdk
mix deps.get
MIX_ENV=test PROXY_DATABASE_TYPE=native SPAWN_SUPERVISORS_STATE_HANDOFF_CONTROLLER=nats SPAWN_USE_INTERNAL_NATS=true SPAWN_PUBSUB_ADAPTER=nats PROXY_CLUSTER_STRATEGY=gossip PROXY_DATABASE_POOL_SIZE=15 PROXY_HTTP_PORT=9005 SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
cd ../../
- name: Run tests spawn_statestores_postgres
run: |
cd spawn_statestores/statestores_postgres
mix deps.get
MIX_ENV=test \
PROXY_DATABASE_TYPE=postgres \
PROXY_DATABASE_PORT=5432 \
PROXY_DATABASE_POOL_SIZE=10 \
PROXY_DATABASE_USERNAME=postgres \
PROXY_DATABASE_SECRET=postgres \
PROXY_CLUSTER_STRATEGY=gossip \
PROXY_HTTP_PORT=9005 \
SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= \
elixir --name [email protected] -S mix test --max-cases=1
cd ../../
# - name: Run tests spawn_statestores_mariadb
# run: |
# cd spawn_statestores/statestores_mariadb
# mix deps.get
# MIX_ENV=test \
# PROXY_DATABASE_TYPE=mariadb \
# PROXY_DATABASE_PORT=3307 \
# PROXY_DATABASE_USERNAME=admin \
# PROXY_DATABASE_SECRET=admin \
# PROXY_CLUSTER_STRATEGY=gossip \
# PROXY_HTTP_PORT=9005 \
# SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= \
# elixir --name [email protected] -S mix test
# cd ../../
- name: Run tests statestores_native
run: |
cd spawn_statestores/statestores_native
mix deps.get
MIX_ENV=test PROXY_CLUSTER_STRATEGY=gossip PROXY_HTTP_PORT=9005 SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
cd ../../
- name: Run tests proxy
run: |
cd spawn_proxy/proxy
mix deps.get
MIX_ENV=test PROXY_DATABASE_TYPE=native PROXY_CLUSTER_STRATEGY=gossip PROXY_HTTP_PORT=9005 SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
cd ../../
# - name: Run tests operator
# run: |
# cd spawn_operator/spawn_operator
# mix deps.get
# MIX_ENV=test PROXY_DATABASE_TYPE=native PROXY_CLUSTER_STRATEGY=gossip PROXY_HTTP_PORT=9005 SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
# cd ../../