Skip to content

Commit

Permalink
Merge pull request #193 from nimblehq/release/4.1.1
Browse files Browse the repository at this point in the history
Release - 4.1.1
  • Loading branch information
andyduong1920 authored Apr 4, 2022
2 parents e8a3ae5 + 081797a commit 2af70a4
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 54 deletions.
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Team Lead
* @andyduong1920

# Team Members
* @bterone @byhbt @hanam1ni @junan @longnd @rosle @topnimble

# Engineering Leads
CODEOWNERS @nimblehq/engineering-leads
2 changes: 1 addition & 1 deletion .github/wiki/Generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Modify the path to locate the `elixir-templates` directory. For example `~/elixi

- Web project: `make create_phoenix_project PROJECT_DIRECTORY=sample_project OPTIONS="--no-live"`
- Live project: `make create_phoenix_project PROJECT_DIRECTORY=sample_project OPTIONS=""`
- API project: `make create_phoenix_project PROJECT_DIRECTORY=sample_project OPTIONS="--no-html --no-assets"`
- API project: `make create_phoenix_project PROJECT_DIRECTORY=sample_project OPTIONS="--no-html --no-assets --no-live"`

3. Answer the prompt `Fetch and install dependencies? [Yn]` with `n` (not install)

Expand Down
6 changes: 3 additions & 3 deletions .github/wiki/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mix phx.new awesome_project
- API variants do NOT support HTML and Assets configuration.

```bash
mix phx.new awesome_project --no-html --no-assets
mix phx.new awesome_project --no-html --no-assets --no-live
```

- Custom project variants allow us to modify the app name or module name.
Expand All @@ -108,8 +108,8 @@ Web project

API project

- Standard (`mix phx.new awesome_project --no-html --no-assets`)
- Custom (`mix phx.new awesome_project --no-html --no-assets --module=CustomModuleName --app=custom_otp_app_name`)
- Standard (`mix phx.new awesome_project --no-html --no-assets --no-live`)
- Custom (`mix phx.new awesome_project --no-html --no-assets --no-live --module=CustomModuleName --app=custom_otp_app_name`)

LiveView project

Expand Down
48 changes: 42 additions & 6 deletions .github/workflows/apply_api_variant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,62 @@ jobs:
name: Test on a Standard API project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-html --no-assets"
new_project_options: "--no-html --no-assets --no-live"
variant: "api"

non-standard_api_project:
name: Test on a Non-Standard API project
long_custom_name_api_project:
name: Test on a long custom name API project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-html --no-assets --module=SampleCustomModule --app=sample_custom_app"
new_project_options: "--no-html --no-assets --no-live --module=SampleCustomModule --app=sample_custom_app"
variant: "api"

short_custom_name_api_project:
name: Test on a short custom name API project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-html --no-assets --module=Z --app=z"
variant: "api"

standard_web_project:
name: Test on a Standard Web project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-live"
variant: "api"

long_custom_name_web_project:
name: Test on a long custom name Web project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-live --module=SampleCustomModule --app=sample_custom_app"
variant: "api"

short_custom_name_web_project:
name: Test on a short custom name Web project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-live --module=Z --app=z"
variant: "api"


standard_live_project:
name: Test on a Standard Live project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: ""
variant: "api"

non-standard_web_project:
name: Test on a Non-Standard Web project
long_custom_name_live_project:
name: Test on a long custom name Live project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--module=SampleCustomModule --app=sample_custom_app"
variant: "api"

short_custom_name_live_project:
name: Test on a short custom name Live project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--module=Z --app=z"
variant: "api"
13 changes: 10 additions & 3 deletions .github/workflows/apply_live_variant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ jobs:
with:
new_project_options: ""
variant: "live"

non-standard_project:
name: Test on a Non-Standard Live project
long_custom_name_live_project:
name: Test on a long custom name Live project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--module=SampleCustomModule --app=sample_custom_app"
variant: "live"

short_custom_name_live_project:
name: Test on a short custom name Live project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--module=Z --app=z"
variant: "live"
24 changes: 18 additions & 6 deletions .github/workflows/apply_mix_variant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,33 @@ jobs:
uses: ./.github/workflows/reusable_mix_project.yml
with:
new_project_options: ""

non-standard_mix_project:
name: Test on a Non-Standard Mix project
long_custom_name_mix_project:
name: Test on a long custom name Mix project
uses: ./.github/workflows/reusable_mix_project.yml
with:
new_project_options: "--module=SampleCustomModule --app=sample_custom_app"

short_custom_name_mix_project:
name: Test on a short custom name Mix project
uses: ./.github/workflows/reusable_mix_project.yml
with:
new_project_options: "--module=Z --app=z"

standard_mix_supervision_project:
name: Test on a Standard Supervision Mix project
uses: ./.github/workflows/reusable_mix_project.yml
with:
new_project_options: "--sup"

non-standard_mix_supervision_project:
name: Test on a Non-Standard Supervision Mix project
long_custom_name_mix_supervision_project:
name: Test on a long custom name Supervision Mix project
uses: ./.github/workflows/reusable_mix_project.yml
with:
new_project_options: "--sup --module=SampleCustomModule --app=sample_custom_app"

short_custom_name_mix_supervision_project:
name: Test on a short custom name Supervision Mix project
uses: ./.github/workflows/reusable_mix_project.yml
with:
new_project_options: "--sup --module=Z --app=z"
11 changes: 9 additions & 2 deletions .github/workflows/apply_web_variant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ jobs:
new_project_options: "--no-live"
variant: "web"

non-standard_project:
name: Test on a Non-Standard Web project
long_custom_name_web_project:
name: Test on a long custom name Web project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-live --module=SampleCustomModule --app=sample_custom_app"
variant: "web"

short_custom_name_web_project:
name: Test on a short custom name Web project
uses: ./.github/workflows/reusable_phoenix_project.yml
with:
new_project_options: "--no-live --module=Z --app=z"
variant: "web"
2 changes: 1 addition & 1 deletion .github/workflows/reusable_phoenix_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

services:
db:
image: postgres:12.3
image: postgres:14.2
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
Expand Down
17 changes: 11 additions & 6 deletions lib/nimble_template/addons/variants/phoenix/api/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ defmodule NimbleTemplate.Addons.Phoenix.Api.Config do
end

def edit_config_prod(%Project{otp_app: otp_app, web_module: web_module} = project) do
Generator.replace_content(
Generator.delete_content(
"config/prod.exs",
"""
config :#{otp_app}, #{web_module}.Endpoint,
""",
"""
config :#{otp_app}, #{web_module}.Endpoint.Anchor
# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
# when generating URLs.
#
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
"""
)

Generator.delete_content(
"config/prod.exs",
"config :#{otp_app}, #{web_module}.Endpoint.Anchor"
"config :#{otp_app}, #{web_module}.Endpoint,"
)

Generator.delete_content(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule NimbleTemplate.Addons.Phoenix.Api.FallbackController do

files = [
{:eex, "lib/otp_app_web/controllers/api/fallback_controller.ex.eex",
"#{web_path}/controller/api/fallback_controller.ex"}
"#{web_path}/controllers/api/fallback_controller.ex"}
]

Generator.copy_file(files, binding)
Expand Down
2 changes: 1 addition & 1 deletion lib/nimble_template/templates/template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule NimbleTemplate.Templates.Template do
end

defp fetch_and_install_elixir_dependencies() do
Mix.shell().cmd("MIX_ENV=develop mix do deps.get, deps.compile")
Mix.shell().cmd("MIX_ENV=dev mix do deps.get, deps.compile")
Mix.shell().cmd("MIX_ENV=test mix do deps.get, deps.compile")
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule NimbleTemplate.MixProject do
def project do
[
app: :nimble_template,
version: "4.1.0",
version: "4.1.1",
description: "Phoenix/Mix template for projects at [Nimble](https://nimblehq.co/).",
elixir: "~> 1.13.3",
elixirc_paths: elixirc_paths(Mix.env()),
Expand Down
38 changes: 19 additions & 19 deletions priv/templates/nimble_template/.github/workflows/test.yml.eex
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ jobs:
<% end %>
lint_codebase:
name: Linting

needs: install_and_compile_dependencies

runs-on: ubuntu-latest

services:
db:
image: postgres:12.3
image: postgres:14.2
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
Expand Down Expand Up @@ -150,17 +150,17 @@ jobs:

- name: Run codebase check
run: mix codebase

test_database_seeds:
name: Test database seeds

needs: lint_codebase

runs-on: ubuntu-latest

services:
db:
image: postgres:12.3
image: postgres:14.2
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
Expand All @@ -169,7 +169,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
MIX_ENV: dev

Expand Down Expand Up @@ -228,17 +228,17 @@ jobs:

- name: Seed database
run: mix run priv/repo/seeds.exs

unit_test:
name: Unit test

needs: lint_codebase

runs-on: ubuntu-latest

services:
db:
image: postgres:12.3
image: postgres:14.2
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
Expand Down Expand Up @@ -313,14 +313,14 @@ jobs:
<%= if web_project? do %>
feature_test:
name: Feature test

needs: lint_codebase

runs-on: ubuntu-latest

services:
db:
image: postgres:12.3
image: postgres:14.2
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
Expand All @@ -329,9 +329,9 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5

# To have parallel feature test jobs, adjust the `mix_test_partition` here and the `--partitions option` in the `Run test` step.
# Example:
# Example:
# - mix_test_partition: [1, 2, 3, 4]
# - mix test --only feature_test --partitions 4
strategy:
Expand All @@ -349,7 +349,7 @@ jobs:
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}

- name: Set up Node
uses: actions/[email protected]
with:
Expand Down Expand Up @@ -384,7 +384,7 @@ jobs:

- name: Compile assets
run: mix assets.deploy

- name: Create database
run: mix ecto.create

Expand Down
2 changes: 1 addition & 1 deletion priv/templates/nimble_template/coveralls.json.eex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lib/<%= otp_app %>_web/telemetry.ex",
"lib/<%= otp_app %>_web/channels/user_socket.ex",
"lib/<%= otp_app %>_web/views/error_helpers.ex",
"lib/<%= otp_app %>_web/controller/api/fallback_controller.ex",
"lib/<%= otp_app %>_web/controllers/api/fallback_controller.ex",
"test/support"
],
"coverage_options": {
Expand Down
2 changes: 1 addition & 1 deletion priv/templates/nimble_template/docker-compose.dev.yml.eex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
db:
image: postgres:12.3
image: postgres:14.2
container_name: <%= otp_app %>_db
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
Expand Down
2 changes: 1 addition & 1 deletion test/nimble_template/addons/variants/docker_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule NimbleTemplate.Addons.Phoenix.DockerTest do
services:
db:
image: postgres:12.3
image: postgres:14.2
container_name: nimble_template_db
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
Expand Down
Loading

0 comments on commit 2af70a4

Please sign in to comment.