Skip to content

Commit

Permalink
chore: add soebelow and dialyzer (commented out), split steps (#2097)
Browse files Browse the repository at this point in the history
* chore: add soebelow and dialyzer to ci

* chore: comment out dialyzer and sobelow

* chore: update action name

* chore: adjust makefile test

* chore: change test command

* chore: add wal_level config

* chore: add connection values

* fix: name of matrix

* chore: set wal level in test_helper

* chore: add comments

* chore: formatting

* chore: streamline setup migration

* chore: add deps compilation

* chore: add test env var

* chore: add cargo lockfile to cache key

* chore: use setup file mount

* chore: try using supabase postges

* chore: use bitnami

* chore: use specfic image

* chore: increase health retries

* chore: update health check
  • Loading branch information
Ziinc authored Jul 18, 2024
1 parent d406a8d commit 26c3548
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
56 changes: 32 additions & 24 deletions .github/workflows/elixir-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,45 @@ on:
permissions:
contents: read

env:
MIX_ENV: test


jobs:
build:
name: Build and test
check:
name: Checks
runs-on: ubuntu-latest
strategy:
matrix:
commands:
- name: Code Quality - Linting
run: mix lint --only warnings
- name: Code Quality - Formatting
run: mix test.format
- name: Compilation Warnings
run: mix test.compile
- name: Tests
run: mix do ecto.create, ecto.migrate, test
# - name: Security - Sobelow Code Scan
# run: mix test.security
# - name: Typing check
# run: mix test.typings
services:
postgres:
image: postgres:13
image: bitnami/postgresql:13.15.0
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: logflare_test
POSTGRESQL_WAL_LEVEL: logical
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-cmd "pg_isready -d logflare_test -U postgres -p 5432"
--health-interval 10s
--health-timeout 5s
--health-retries 5
--health-retries 10
env:
MIX_ENV: test
SHELL: /bin/bash
Expand All @@ -57,23 +77,11 @@ jobs:
with:
path: |
deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
_build
dialyzer
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock', '**/Cargo.lock' ) }}
restore-keys: ${{ runner.os }}-mix--dialyzer
- name: Install dependencies
run: mix deps.get
- name: Run DB migrations
run: MIX_ENV=test mix do ecto.create, ecto.migrate
- name: Run compilation warnings check
run: mix test.compile
- name: Run migrations for test environment
run: MIX_ENV=test mix do ecto.drop, ecto.create, ecto.migrate
- name: Run unit tests with code coverage check
run: make test
# - name: Test - security
# run: mix test.security
- name: Code quality - formatting
run: mix test.format
# - name: Code quality - typings
# run: mix test.typings
- name: Code quality - linting
run: mix lint --only warnings
run: mix do deps.get, deps.compile
- name: Run ${{ matrix.commands.name }}
run: ${{ matrix.commands.run }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/*.ez
.DS_Store

dialyzer

# Generated on crash by the VM
erl_crash.dump

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ help:

test:
-epmd -daemon
mix test.coverage
mix test

test.only:
-epmd -daemon
Expand Down
6 changes: 5 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ defmodule Logflare.Mixfile do
"coveralls.post": :test,
"coveralls.html": :test
],
dialyzer: [
plt_local_path: "dialyzer",
plt_core_path: "dialyzer"
],
test_coverage: [tool: ExCoveralls],
releases: [
logflare: [
Expand Down Expand Up @@ -234,7 +238,7 @@ defmodule Logflare.Mixfile do
"test.compile": ["compile --warnings-as-errors"],
"test.format": ["format --check-formatted"],
"test.security": ["sobelow --threshold high --ignore Config.HTTPS"],
"test.typings": ["dialyzer --format short"],
"test.typings": ["cmd mkdir -p dialyzer", "dialyzer"],
"test.coverage": ["coveralls"],
lint: ["credo"],
"lint.diff": ["credo diff master"],
Expand Down

0 comments on commit 26c3548

Please sign in to comment.