Compare commits
6 Commits
e586a29e75
...
076b41eadd
Author | SHA1 | Date | |
---|---|---|---|
|
076b41eadd | ||
|
2e5373ae3f | ||
|
5334fff7a2 | ||
|
060ade05eb | ||
|
168ca704cd | ||
39419f8837 |
49
.drone.yml
49
.drone.yml
@@ -5,7 +5,6 @@ name: test
|
|||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -17,6 +16,26 @@ steps:
|
|||||||
PGHOST: db
|
PGHOST: db
|
||||||
commands:
|
commands:
|
||||||
- while ! pg_isready; do sleep 1; done
|
- while ! pg_isready; do sleep 1; done
|
||||||
|
|
||||||
|
- name: restore cache
|
||||||
|
image: 'meltwater/drone-cache:v1.3.0'
|
||||||
|
environment:
|
||||||
|
AWS_ACCESS_KEY_ID:
|
||||||
|
from_secret: minio_user
|
||||||
|
AWS_SECRET_ACCESS_KEY:
|
||||||
|
from_secret: minio_password
|
||||||
|
settings:
|
||||||
|
archive_format: gzip
|
||||||
|
bucket: trainlog-cache
|
||||||
|
cache_key: '{{ .Repo.Name }}-{{ checksum "mix.lock" }}'
|
||||||
|
endpoint: minio:9000
|
||||||
|
mount:
|
||||||
|
- _build
|
||||||
|
- deps
|
||||||
|
path_style: true
|
||||||
|
region: us-east-1
|
||||||
|
restore: true
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
image: 'elixir:1.13.4'
|
image: 'elixir:1.13.4'
|
||||||
environment:
|
environment:
|
||||||
@@ -26,7 +45,33 @@ steps:
|
|||||||
POSTGRES_PASS: postgres
|
POSTGRES_PASS: postgres
|
||||||
commands:
|
commands:
|
||||||
- mix do local.rebar --force, local.hex --force, deps.get, deps.compile
|
- mix do local.rebar --force, local.hex --force, deps.get, deps.compile
|
||||||
- mix test --cover --trace --slowest 10
|
- make test
|
||||||
|
|
||||||
|
- name: lint
|
||||||
|
image: 'elixir:1.13.4'
|
||||||
|
commands:
|
||||||
|
- mix do local.rebar --force, local.hex --force, deps.get, deps.compile
|
||||||
|
- make static_code_analysis
|
||||||
|
|
||||||
|
- name: rebuild cache
|
||||||
|
image: 'meltwater/drone-cache:v1.3.0'
|
||||||
|
environment:
|
||||||
|
AWS_ACCESS_KEY_ID:
|
||||||
|
from_secret: minio_user
|
||||||
|
AWS_SECRET_ACCESS_KEY:
|
||||||
|
from_secret: minio_password
|
||||||
|
settings:
|
||||||
|
archive_format: gzip
|
||||||
|
bucket: trainlog-cache
|
||||||
|
cache_key: '{{ .Repo.Name }}-{{ checksum "mix.lock" }}'
|
||||||
|
endpoint: minio:9000
|
||||||
|
exit_code: true
|
||||||
|
mount:
|
||||||
|
- _build
|
||||||
|
- deps
|
||||||
|
path_style: true
|
||||||
|
rebuild: true
|
||||||
|
region: us-east-1
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- name: db
|
- name: db
|
||||||
|
142
.github/workflows/ci.yml
vendored
142
.github/workflows/ci.yml
vendored
@@ -1,142 +0,0 @@
|
|||||||
---
|
|
||||||
# based on:
|
|
||||||
# 1. https://dev.to/mnishiguchi/basic-github-actions-setup-for-phoenix-apps-m3g
|
|
||||||
# 2. https://www.jonathanyeong.com/garden/how-to-setup-ci-with-phoenix-github-actions/
|
|
||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
brances: [main]
|
|
||||||
|
|
||||||
env:
|
|
||||||
MIX_ENV: test
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dependencies:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
elixir: ['1.12.1']
|
|
||||||
otp: ['24.0.2']
|
|
||||||
steps:
|
|
||||||
- name: cancel previous execution
|
|
||||||
uses: styfle/cancel-workflow-action@0.9.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
- name: checkout repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: setup erlang/elixir
|
|
||||||
uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
elixir-version: ${{ matrix.elixir }}
|
|
||||||
otp-version: ${{ matrix.otp }}
|
|
||||||
- name: fecth cached dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
id: mix-cache
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
deps
|
|
||||||
_build
|
|
||||||
priv/plts
|
|
||||||
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
|
|
||||||
- name: install dependencies
|
|
||||||
if: steps.mix-cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
mkdir -p priv/plts
|
|
||||||
mix local.rebar --force
|
|
||||||
mix local.hex --force
|
|
||||||
mix deps.get
|
|
||||||
mix deps.compile
|
|
||||||
mix dialyzer --plt
|
|
||||||
static-code-analysis:
|
|
||||||
needs: dependencies
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
elixir: ['1.12.1']
|
|
||||||
otp: ['24.0.2']
|
|
||||||
steps:
|
|
||||||
- name: cancel previous execution
|
|
||||||
uses: styfle/cancel-workflow-action@0.9.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
- name: checkout repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: setup erlang/elixir
|
|
||||||
uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
elixir-version: ${{ matrix.elixir }}
|
|
||||||
otp-version: ${{ matrix.otp }}
|
|
||||||
- name: fecth cached dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
id: mix-cache
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
deps
|
|
||||||
_build
|
|
||||||
priv/plts
|
|
||||||
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
|
|
||||||
- run: mix format --check-formatted
|
|
||||||
- name: credo analysis
|
|
||||||
uses: red-shirts/reviewdog-action-credo@v1
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.github_token }}
|
|
||||||
reporter: github-pr-review
|
|
||||||
- run: mix dialyzer --no-check --quiet --ignore-exit-status --format short
|
|
||||||
test:
|
|
||||||
needs: dependencies
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
elixir: ['1.12.1']
|
|
||||||
otp: ['24.0.2']
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: 'postgres:13.3-alpine'
|
|
||||||
ports:
|
|
||||||
- '5432:5432'
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
steps:
|
|
||||||
- name: cancel previous execution
|
|
||||||
uses: styfle/cancel-workflow-action@0.9.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
- name: checkout repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: setup erlang/elixir
|
|
||||||
uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
elixir-version: ${{ matrix.elixir }}
|
|
||||||
otp-version: ${{ matrix.otp }}
|
|
||||||
- name: fecth cached dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
id: mix-cache
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
deps
|
|
||||||
_build
|
|
||||||
priv/plts
|
|
||||||
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
|
|
||||||
- run: mix test --cover --trace --slowest 10
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASS: postgres
|
|
||||||
- name: publish test results
|
|
||||||
uses: EnricoMi/publish-unit-test-result-action/composite@v1
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
files: 'report/test/*.xml'
|
|
||||||
- name: publish coverage report
|
|
||||||
uses: romeovs/lcov-reporter-action@v0.2.16
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
lcov-file: 'cover/lcov.info'
|
|
@@ -17,7 +17,7 @@ defmodule WabanexWeb.Schema.Types.Custom.DateRange do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@spec serialize_range(PgRanges.DateRange.t()) :: String.t()
|
@spec serialize_range(PgRanges.DateRange.t()) :: String.t()
|
||||||
@spec serialize_range(list(String.t())) :: String.t()
|
@spec serialize_range(list(DateTime.t() | nil)) :: String.t()
|
||||||
defp serialize_range(%PgRanges.DateRange{lower: start_range, upper: end_range}),
|
defp serialize_range(%PgRanges.DateRange{lower: start_range, upper: end_range}),
|
||||||
do: serialize_range([start_range, end_range])
|
do: serialize_range([start_range, end_range])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user