build(CI/CD): Added elixir_ci.yml 'Build and test' job for Github Act… #8
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: Elixir CI | |
on: | |
push: | |
branches: | |
- main | |
- "release/*" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: my_app_test | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
MIX_ENV: test | |
DATABASE_URL: postgres://postgres:postgres@localhost/my_app_test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-elixir@v1 | |
with: | |
elixir-version: 1.15.7 | |
otp-version: 26.0 | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Compile Elixir code | |
run: mix compile | |
- name: Setup database | |
run: | | |
mix ecto.create | |
mix ecto.migrate | |
- name: List test files | |
run: | | |
echo "Listing test files:" | |
ls -l test | |
- name: Run tests | |
run: mix test |