Skip to content

Commit

Permalink
Merge pull request #181 from coingaming/feat/test-on-circle
Browse files Browse the repository at this point in the history
Feat/test on circle
  • Loading branch information
theycallmehero authored Nov 4, 2021
2 parents 15175b5 + 2130aa0 commit f7f76f7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 55 deletions.
76 changes: 42 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,45 @@ jobs:
root: ./
paths:
- release.tar.gz
check_code_quality:
docker:
- image: heathmont/elixir-ci:1.12.3-otp-24-alpine
environment:
MIX_ENV: test
steps:
- checkout
- run:
name: Check variables
command: ./scripts/deploy/check-vars "in system" "ROBOT_SSH_KEY" "DOCKER_EMAIL" "DOCKER_ORG" "DOCKER_PASS" "DOCKER_USER" "HEX_API_KEY"
- run:
name: Setup robot SSH key
command: echo "$ROBOT_SSH_KEY" | base64 -d > $HOME/.ssh/id_rsa.robot && chmod 600 $HOME/.ssh/id_rsa.robot && ssh-add $HOME/.ssh/id_rsa.robot
- run:
name: Setup SSH config
command: echo -e "Host *\n IdentityFile $HOME/.ssh/id_rsa.robot\n IdentitiesOnly yes" > $HOME/.ssh/config
- restore_cache:
keys:
- v5-build-{{ checksum "mix.lock" }}-{{ .Revision }}
- v5-build-{{ checksum "mix.lock" }}-
- v5-build-
- run:
command: git submodule update --init --recursive
- run:
command: mix hex.organization auth coingaming --key $HEX_API_KEY
- run:
command: mix archive.install hex ex_env 0.3.1 --force
- run:
command: mix setup
- run:
command: mix assets.setup
- run:
command: mix format --check-formatted
- run:
command: mix credo
- run:
command: mix surface.format --check-formatted
- run:
command: mix test
docker_image:
docker:
- image: heathmont/elixir-ci:1.12.3-otp-24-alpine
Expand Down Expand Up @@ -93,47 +132,16 @@ jobs:
- run:
name: Deploy
command: scripts/deploy/stacks-deploy $CIRCLE_TAG
check_formatted:
docker:
- image: heathmont/elixir-ci:1.12.3-otp-24-alpine
steps:
- checkout
- restore_cache:
keys:
- v5-build-{{ checksum "mix.lock" }}-{{ .Revision }}
- v5-build-{{ checksum "mix.lock" }}-
- v5-build-
- run:
name: Mix format
command: mix format --check-formatted
- run:
name: Update git submodules
command: git submodule update --init --recursive
- run:
name: Hex auth
command: mix hex.organization auth coingaming --key $HEX_API_KEY
- run:
name: ExEnv
command: mix archive.install hex ex_env 0.3.1 --force
- run:
name: Fetch dependencies
command: mix deps.get
- run:
name: Surface format
command: mix surface.format --check-formatted
- save_cache:
key: v5-build-{{ checksum "mix.lock" }}-{{ .Revision }}
paths:
- .cache
- deps
- ~/.mix


workflows:
version: 2
workflow:
jobs:
- otp_release:
context: global
- check_code_quality:
context: global
- docker_image:
context: global
filters:
Expand Down
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,8 @@ In writing code try to remember following rules:

1. Code should be as short and simple as possible (less lines is better)
2. Code should be as explicit as possible (and compiler should catch as many errors as possible)

So as an example, when considering following code approaches, which one you should pick?

```
alias Moon.Components.TextInput
<TextInput
left_icon="icon_zoom"
right_icon="icon_close_rounded"
right_icon_click="clear_search"
placeholder="Search for dashboard, segments and more"
/>
```

or
3. Use slots
4. Run tests

```
alias Moon.Components.TextInput
Expand All @@ -60,4 +47,7 @@ alias Moon.Assets.Icons.IconZoom
</TextInput>
```

Second example is a bit longer, but has much better compiler error checks.
```bash
mix test
```

2 changes: 1 addition & 1 deletion lib/moon_web/pages/assets/currencies_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ defmodule MoonWeb.Pages.Assets.CurrenciesPage do

use MoonWeb, :live_view

alias Moon.Assets.Currency
alias Moon.Assets.Currencies
alias Moon.Assets.Currency
alias Moon.Autolayouts.TopToDown
alias Moon.Components.CodePreview
alias Moon.Components.Heading
Expand Down
3 changes: 1 addition & 2 deletions lib/moon_web/pages/example_pages/shared/top_menu/search.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ defmodule MoonWeb.Pages.ExamplePages.Shared.TopMenu.Search do
class="w-128 max-w-md"
>
<TextInput
right_icon_click="clear_search"
placeholder="Search for dashboard, segments and more"
field={:search_text}
value={@search_map.search_text}
on_focus="activate_search"
class="bg-goku-100 h-10 border-transparent"
>
<:left_icon><IconZoom /></:left_icon>
<:right_icon :if={should_show_close_search(@search_map)}><IconCloseRounded /></:right_icon>
<:right_icon :if={should_show_close_search(@search_map)}><IconCloseRounded click="clear_search" /></:right_icon>
</TextInput>
</Form>
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ defmodule Moon.MixProject do

# dev
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:surface_formatter, "~> 0.6", only: :dev},
{:dialyxir, "~> 1.0", only: :dev, runtime: false}
{:surface_formatter, "~> 0.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}
]
end

Expand Down

0 comments on commit f7f76f7

Please sign in to comment.