Skip to content

Commit

Permalink
add ExCoveralls & coveralls.json to check test coverage #53
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Mar 13, 2022
1 parent 6231fab commit f48898f
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 29 deletions.
143 changes: 128 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
![sleep-hero-image](https://user-images.githubusercontent.com/194400/159523182-0db2588a-658d-45ae-8ce3-98c37a47ca72.jpeg)


### _Sleep is the single most effective thing we can do to reset our brain and body health each day._” <br /> ~ Matthew Walker, Why We Sleep: Unlocking the Power of Sleep and Dreams
## _Sleep is the single most effective thing we can do <br /> to reset our brain and body health each day._” <br /> ~ Matthew Walker, Why We Sleep

<br />

[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/dwyl/sleep/Elixir%20CI?label=build&style=flat-square)](https://github.com/dwyl/phoenix-liveview-chat-example/actions/workflows/cy.yml)
[![codecov test coverage](https://img.shields.io/codecov/c/github/dwyl/sleep/main.svg?style=flat-square)](https://codecov.io/github/dwyl/phoenix-liveview-chat-example?branch=main)
[![HitCount](http://hits.dwyl.com/dwyl/sleep.svg?style=flat-square&show=unique)](http://hits.dwyl.com/dwyl/sleep)
[![Hex pm](https://img.shields.io/hexpm/v/phoenix_live_view.svg?style=flat-square)](https://hex.pm/packages/phoenix_live_view)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/dwyl/phoenix-liveview-counter-tutorial/issues)
[![HitCount](http://hits.dwyl.com/dwyl/sleep.svg?style=flat-square)](http://hits.dwyl.com/dwyl/sleep)

**Try it**: [**sleepdev.herokuapp.com**](https://sleepdev.herokuapp.com/)
![wake-sleeping-heroku-app](https://liveview-chat-example.herokuapp.com/ping)
Expand All @@ -34,27 +36,29 @@ aspect of health and longevity.

# Why? 🤷‍♀️

If you don't get a good night's sleep
virtually everything about your next day
When you sleep well and feel rested,
you have mental clarity and energy
to focus on Deep Work tasks.
By contrast if you don't get a good night's sleep
virtually everything about your day
will be worse.

> See below for all the areas sleep affects.

<br />

# What? 📱 🛌

This App is the simplest possible sleep tracker
(_other than using a paper notepad and pen
This App is the simplest possible **sleep tracker**
(_other than using a paper notepad + pen
or a note taking App on your phone ..._)

A deliberatly basic version of an App is
A **_deliberately_ basic** version of an App is
commonly referred to as Minimum Viable Product ("MVP")
which means it has the minimum features to be useful,
but leaves a lot enhancements out.

If you think of a feature/improvement, _please_
[**open an issue**!](https://github.com/dwyl/sleep/issues)
[**open an issue**!](https://github.com/dwyl/sleep/issues). <br />
**Contributions/ideas** are **_always_ welcome**
and we're delighted to extend this
in response to feedback!
Expand All @@ -73,26 +77,40 @@ You can start using the MVP _now_ (_tonight_)!

> If you're reading this past **22:00**,
go straight to the "***Try it!***" section
and treat yourself to an _early_ night!
and start recording your sleep _now_.
Bookmark (⭐) the project
and come back to it tomorrow
and come back to it tomorrow.

<br />

It's never too late
to start focusing on your sleep quality.
The benefits of good sleep habits
will last the rest of your life
and may _extend_ it!

<br />

# How? 👩‍💻

There are 3 steps to this:

# How?
1. Try it! (2 mins)
2. Run it! (5 mins)
3. Build it! (20 mins)

Let's get started.

<br />

## _Try_ it!
## 1. _Try_ it!

Firstly, if you haven't already,
you can _try_ the App via Heroku:
https://sleepdev.herokuapp.com

# @TODO: insert GIF of _performing_ the actions!

Try the following actions:

+ **Log _in_**
Expand All @@ -102,13 +120,82 @@ Try the following actions:
+ **Log _back in_** - with the same Google or GitHub account you used to login before.
+ ***Confirm*** your "sleep" session was recorded.

Once you've given the app a quick test,
it's time try _running_ it.

<br />

## _Run_ it!
## 2. _Run_ it!

Now that you've tried it on Heroku,
if you want to dig deeper,
try running the _finished_ (MVP) on your computer.


## Prerequisites 📝

Make sure you have the following installed:

+ [x] Elixir:
https://elixir-lang.org/install.html
+ [x] Phoenix:
https://hexdocs.pm/phoenix/installation.html
+ [x] Postgres:
https://www.postgresql.org/download

### _Check_ You Have Everything _Before_ Starting

Check you have the _latest version_ of **Elixir**
(_run the following command in your terminal_):

```sh
elixir -v
```

You should see something like:

```sh
Erlang/OTP 24 [erts-12.1.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.13 (compiled with Erlang/OTP 22)
```

Check you have the **latest** version of **Phoenix**:

```sh
mix phx.new -v
```

You should see:

```sh
Phoenix v1.6.6
```

_Confirm_ **PostgreSQL** is running (_so the App can store chat messages_)
run the following command:

```sh
lsof -i :5432
```

You should see output _similar_ to the following:

```sh
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 529 Alex 5u IPv6 0xbc5d729e529f062b 0t0 TCP localhost:postgresql (LISTEN)
postgres 529 Alex 6u IPv4 0xbc5d729e55a89a13 0t0 TCP localhost:postgresql (LISTEN)
```

This tells us that PostgreSQL is "_listening_" on TCP Port `5432`
(_the default port_)

With all those "pre-flight checks" performed, let's get _going_!

<br />

## Clone, Install & Run the App!

Open a terminal window and run the following commands:

Clone the project to your computer:
Expand Down Expand Up @@ -136,14 +223,38 @@ _Run_ the app:
mix phx.server
```

Open the following URL in your web browser:
http://localhost:4000


You should expect to see the following:

# @TODO: insert screenshot of _finished_ app!

<br />

## 3. _Build_ it! 🚀

Now that you know what the end result
looks & feels like
and you have a reference implementation
that you _know_ works on your computer,
it's time to write some **`code`**

**GOTO**:
[https://github.com/dwyl/sleep/blob/main/tutorial.md](https://github.com/dwyl/sleep/blob/main/tutorial.md)

<br />


<!--
# Research
We have read several books on sleep (_so you don't have to_).
Research findings in byte-size format to follow soon!
### “_Before you sleep, read something that is exquisite, and worth remembering._” ~ <br /> Desiderius Erasmus
Expand All @@ -154,4 +265,6 @@ you will not be able to function.
## How Sleep Affects You
> Insert table of good vs. bad sleep.
> Insert table of good vs. bad sleep.
-->
14 changes: 14 additions & 0 deletions coveralls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"coverage_options": {
"minimum_coverage": 100
},
"skip_files": [
"test/",
"lib/auth/application.ex",
"lib/auth/release.ex",
"lib/auth_web.ex",
"lib/auth_web/views/error_helpers.ex",
"lib/auth_web/channels/user_socket.ex",
"lib/auth_web/telemetry.ex"
]
}
35 changes: 31 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ defmodule App.MixProject do
def project do
[
app: :app,
version: "0.1.0",
version: "1.0.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
deps: deps(),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
c: :test,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test
],
package: package(),
description: "Turnkey Auth Auth Application"
]
end

Expand Down Expand Up @@ -46,7 +56,13 @@ defmodule App.MixProject do
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.18"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"}
{:plug_cowboy, "~> 2.5"},

# Check test coverage
{:excoveralls, "~> 0.14.3", only: :test},

# Create Documentation for publishing Hex.docs:
{:ex_doc, "~> 0.28", only: :dev},
]
end

Expand All @@ -58,11 +74,22 @@ defmodule App.MixProject do
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
c: ["coveralls.html"],
setup: ["deps.get", "ecto.setup"],
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
"assets.deploy": ["esbuild default --minify", "phx.digest"]
"assets.deploy": ["esbuild default --minify", "phx.digest"],
]
end

defp package() do
[
files: ~w(lib LICENSE mix.exs README.md),
name: "sleep",
licenses: ["GPL-2.0-or-later"],
maintainers: ["dwyl"],
links: %{"GitHub" => "https://github.com/dwyl/sleep"}
]
end
end
Loading

0 comments on commit f48898f

Please sign in to comment.