Skip to content

Commit

Permalink
Add database on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Adriano Santos committed Jun 3, 2022
1 parent f6cbd17 commit fa7a793
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ jobs:
build:
name: Build and Test OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
runs-on: ubuntu-latest
services:
db:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
image: postgres:11
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
otp: [23, 24, 25]
Expand Down Expand Up @@ -45,4 +58,6 @@ jobs:
mix deps.clean --all
mix deps.get
- name: Run tests
run: cd apps/spawn && MIX_ENV=test SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
run: |
cd apps/spawn
MIX_ENV=test PROXY_DATABASE_TYPE=mysql PROXY_DATABASE_NAME=posgres PROXY_DATABASE_USERNAME=postgres PROXY_DATABASE_SECRET=postgres SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name [email protected] -S mix test
20 changes: 17 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ jobs:
build:
name: Build and Test OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
runs-on: ubuntu-latest
services:
db:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
image: postgres:11
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
otp: [23, 24, 25]
Expand Down Expand Up @@ -43,13 +56,14 @@ jobs:
cd apps/spawn
mix deps.clean --all
mix do deps.get, deps.compile
- name: Check format
run: mix format --check-formatted

- name: Run tests
with:
path: apps/spawn
run: cd apps/spawn && MIX_ENV=test SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name test@127.0.0.1 -S mix test
run: |
cd apps/spawn
MIX_ENV=test PROXY_DATABASE_TYPE=mysql PROXY_DATABASE_NAME=posgres PROXY_DATABASE_USERNAME=postgres PROXY_DATABASE_SECRET=postgres SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= elixir --name spawn@127.0.0.1 -S mix test
build-and-push-image:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config :statestores, Statestores.Adapters.MySQL,
pool: Ecto.Adapters.SQL.Sandbox

0 comments on commit fa7a793

Please sign in to comment.