Skip to content

Commit

Permalink
feat(config): Update some templates related to runtime configuration (#…
Browse files Browse the repository at this point in the history
…53)

* fix(deps): Update some templates

* fix(settings): Udate Agent for config and secrets adapter

* fix(deps): Update some templates

* fix(deps): update deps and downgrade elixir because rabbit compatibility

* fix(acceptance): update test script

* docs: update docs and dependencies
  • Loading branch information
juancgalvis authored Aug 6, 2024
1 parent 1d0098d commit 3bc0772
Show file tree
Hide file tree
Showing 42 changed files with 2,163 additions and 3,231 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,30 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Generate a token
- name: Generate a token of Github APP
id: generate_token
uses: tibdex/github-app-token@v2
if: github.ref == 'refs/heads/main'
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
with:
app_id: ${{ secrets.APP_ID_ADMIN_GITHUB }}
private_key: ${{ secrets.APP_PRIVATE_KEY_ADMIN_GITHUB }}
- uses: actions/checkout@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
if: github.ref == 'refs/heads/main'
with:
token: ${{ steps.generate_token.outputs.token }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
if: github.ref != 'refs/heads/main'

- name: Verify Conventional Commits
uses: amannn/action-semantic-pull-request@v5
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up NodeJS
if: github.ref == 'refs/heads/main'
uses: actions/setup-node@v4
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version-file: ".nvmrc"
node-version-file: '.nvmrc'
- name: Set up Semantic Release
if: github.ref == 'refs/heads/main'
run: npm -g install @semantic-release/git [email protected]
Expand All @@ -44,6 +49,8 @@ jobs:
run: npx [email protected]
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}


- name: Set up Elixir
uses: erlef/[email protected]
with:
Expand All @@ -63,8 +70,8 @@ jobs:
run: mix format --check-formatted
- name: Code analysis
run: mix credo --strict && mix dialyzer
- name: Install as archive
run: mix do archive.build, archive.install --force
- name: Test generated code
run: ./sh_acceptance.sh
- name: Tests & Coverage (main)
if: github.ref == 'refs/heads/main'
run: mix coveralls.github
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 27.0
elixir 1.17.1-otp-27
erlang 26.2.5
elixir 1.16.2-otp-26
2 changes: 0 additions & 2 deletions deploy_local.sh

This file was deleted.

40 changes: 9 additions & 31 deletions docs/docs/getting-started/1-create-a-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,25 @@ sidebar_position: 1

# Create a Project

## Available Mix Tasks

```shell
mix help | grep "mix ca."
```

| Task | Description |
|-----------------------|-----------------------------------------------------------|
| mix ca.new.structure | Creates a new clean architecture application. |
| mix ca.new.model | Creates a new model with empty properties |
| mix ca.new.usecase | Creates a new usecase |
| mix ca.new.da | Creates a new driven adapter |
| mix ca.new.ep | Creates a new entry point |
| mix ca.apply.config | Applies some project configuration |
| mix ca.update | Updates dependencies to latest stable version from hex.pm |

### Task detail

```bash
mix <task> -h
```

Example

```bash
mix ca.new.structure -h
```

```
Creates a new Clean architecture scaffold
$ mix ca.new.structure [application_name]
$ mix ca.new.structure [application_name] --metrics --sonar
$ mix ca.new.structure [application_name] -m -s
$ mix ca.new.structure [application_name] --metrics --sonar --monorepo
$ mix ca.new.structure [application_name] -m -s -r
```

## Creating a new project


The `ca.new.structure` task will generate a clean architecture structure in your project.

### Options

- `--metrics` or `-m`: this option will create a basic setup for metrics, this can be done after project creation too, by executing `mix ca.apply.config -t metrics`
- `--sonar` or `-s`: this option will create a basic setup for sonar reports, this can be done after project creation too, by executing `mix ca.apply.config -t sonar`
- `--monorepo` or `-r`: this option will create a basic set some paths relative to project name.

```bash
mix ca.new.structure <project-name>

Expand Down Expand Up @@ -84,7 +62,7 @@ app
│   │   ├── api_rest.ex
│   │   └── health_check.ex
│   └── utils
│   ├── custom_telemetry.ex
│   ├── custom_telemetry.ex # if --metrics enabled
│   └── data_type_utils.ex
├── mix.exs
├── mix.lock
Expand Down
13 changes: 13 additions & 0 deletions docs/docs/getting-started/6-updating-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
sidebar_position: 6
---

# Updating project

There is a task with capability for update project, this taks currently supports upgrade dependencies only

```bash
mix ca.update
```

If your dependencies have some incompatibility issues you should downgrade the non compliant dependency to a previos version until it works as spected.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 99
---

# Do you need a new capability?
Expand Down
28 changes: 28 additions & 0 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,31 @@ Elixir plugin to create an elixir application based on Clean Architecture follow
```bash
mix archive.install hex elixir_structure_manager <version>
```

## Available Mix Tasks

```shell
mix help | grep "mix ca."
```

| Task | Description |
|-----------------------|-----------------------------------------------------------|
| mix ca.new.structure | Creates a new clean architecture application. |
| mix ca.new.model | Creates a new model with empty properties |
| mix ca.new.usecase | Creates a new usecase |
| mix ca.new.da | Creates a new driven adapter |
| mix ca.new.ep | Creates a new entry point |
| mix ca.apply.config | Applies some project configuration |
| mix ca.update | Updates dependencies to latest stable version from hex.pm |

### Task detail

```bash
mix <task> -h
```

Example

```bash
mix ca.new.structure -h
```
Loading

0 comments on commit 3bc0772

Please sign in to comment.