Merge pull request #413 from eigr/dependabot/hex/k8s-2.6.2 #1952
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ../../ | |