Skip to content

Commit f603c14

Browse files
author
dixyushi
committed
Merge remote-tracking branch 'upstream/main' into main
2 parents afd2b41 + 963b79d commit f603c14

16 files changed

Lines changed: 336 additions & 47 deletions

.github/workflows/syntaxCheckPullRequest.yml

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,42 @@ on:
44
pull_request_target:
55
branches: [ main ]
66
jobs:
7-
build:
7+
setup-matrix:
88
runs-on: ubuntu-latest
9+
env:
10+
PR_NUMBER: ${{github.event.number}}
11+
12+
steps:
13+
- name: Checkout playbooks
14+
uses: actions/checkout@v2
15+
- name: Install node environment
16+
uses: actions/setup-node@v2-beta
17+
- name: npm install
18+
run: npm install
19+
- name: Select Changed Files
20+
id: changedfiles
21+
run: |
22+
node selectChangedFiles.js
23+
- name: Setup matrix combinations
24+
id: setup-matrix-combinations
25+
run: |
26+
dirs=()
27+
for changed_file in ${{ steps.changedfiles.outputs.changedFiles }}; do
28+
dir="$(echo $changed_file | cut -d/ -f1)"
29+
if [[ ! " ${dirs[@]} " =~ " ${dir} " ]]; then
30+
MATRIX_PARAMS_COMBINATIONS=$MATRIX_PARAMS_COMBINATIONS'{"tutorial": "'$dir'"},'
31+
fi
32+
dirs+=($dir)
33+
done
34+
echo ::set-output name=matrix-combinations::{\"include\":[$MATRIX_PARAMS_COMBINATIONS]}
35+
outputs:
36+
matrix-combinations: ${{ steps.setup-matrix-combinations.outputs.matrix-combinations }}
937

38+
build:
39+
runs-on: ubuntu-latest
40+
needs: setup-matrix
41+
strategy:
42+
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix-combinations) }}
1043
steps:
1144
- name: Checkout tutorial-compiler
1245
uses: actions/checkout@v2
@@ -28,19 +61,30 @@ jobs:
2861
run: npm install
2962

3063
- name: run buildRun.sh --user ${{ github.actor }} --branch ${{ github.event.pull_request_target.head.ref }} --checkSyntax
31-
run: sh buildRun.sh --user ${{ github.actor }} --branch ${{ github.event.pull_request_target.head.ref }} --checkSyntax -e katacoda
32-
64+
run: |
65+
sh buildRun.sh --user ${{ github.actor }} --branch ${{ github.event.pull_request_target.head.ref }} --checkSyntax -p ${{ matrix.tutorial }} -e test_console
66+
67+
- name: Check error file existence
68+
id: check_files
69+
uses: andstor/file-existence-action@v1
70+
with:
71+
files: "./build/errors/syntaxErrors.md"
72+
3373
- name: Get message
3474
id: get_message
75+
if: steps.check_files.outputs.files_exists == 'true'
3576
run: |
3677
message=`cat ./build/errors/syntaxErrors.md`
37-
echo ${message}
78+
message="${message//'%'/'%25'}"
79+
message="${message//$'\n'/'%0A'}"
80+
message="${message//$'\r'/'%0D'}"
81+
echo "${message}"
3882
echo "::set-output name=message::$message"
3983
4084
- name: Request changes
4185
if: ${{ steps.get_message.outputs.message != '' }}
4286
uses: andrewmusgrave/automatic-pull-request-review@0.0.2
4387
with:
4488
repo-token: '${{ secrets.GITHUB_TOKEN }}'
45-
event: REQUEST_CHANGES
89+
event: COMMENT
4690
body: ${{ steps.get_message.outputs.message }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cd devonfw/workspaces/main
2+
git clone https://github.com/devonfw/devon4ng-application-template.git
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cd devonfw/workspaces/main
2+
git clone https://github.com/devonfw/devon4ng-application-template.git
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In the `CoreModule`, you can see services like `TranslocoRootModule` (translation service), `HttpRequestInterceptorService` (HTTP interceptor sesrvice) and Angular Material related modules being part of this core module. This core module is then imported into every other module as the services are used throughout the application.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In the `LayoutModule`, you can see components like `NavBar` and `Header` being part of this module. This module is comparable to a **shared** module which holds common components used throughout the application. The shared module is imported into other (feature) modules where the common components will be used.
2+
3+
You can study in more detail about Angular architecture by following [this document](https://devonfw.com/website/pages/docs/master-devon4ng.asciidoc_architecture.html#meta-architecture.asciidoc_devonfw-reference-client-architecture).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The applciation you see here is a clone of devon4ng-application-template. You can find it here [here](https://github.com/devonfw/devon4ng-application-template)
2+
3+
The `SampleDataModule` is a nice exmple of the different layers explained. It holds some components (representing the *components* layer) and also has a `SampleDataService` (representing the *service* layer) which is imported in the required components.
4+
5+
The service acts as the adapter element explained earlier (used to make XHR calls).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The architecture describes two layers:
2+
3+
* [Components Layer](https://devonfw.com/website/pages/docs/master-devon4ng.asciidoc_layers.html#components-layer.asciidoc) encapsulates components which present the current application state. Components are separated into [Smart and Dumb Components](https://devonfw.com/website/pages/docs/master-devon4ng.asciidoc_layers.html#components-layer.asciidoc_smart-and-dumb-components). The only logic present is view logic inside Smart Components.
4+
5+
* [Services Layer](https://devonfw.com/website/pages/docs/master-devon4ng.asciidoc_layers.html#services-layer.asciidoc) is more or less what we call 'business logic layer' on the server side. The layer defines the applications state, the transitions between state and classic business logic. Stores contain application state over time to which Smart Components subscribe to. Adapters are used to perform XHRs, WebSocket connections, etc. The business model is described inside the module. Use case services perform business logic needed for use cases. A use case services interacts with the store and adapters. Methods of use case services are the API for Smart Components. Those methods are Actions in reactive terminology.
6+
7+
Let us refer the application to understand the above concepts.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Every Angular application requires a module called app which is the main entrance to an application at runtime - this module gets bootstrapped. Angular Styleguide defines feature modules and two special modules - core and shared.
2+
3+
* A **feature** module is basically a vertical cut through both layers.
4+
5+
* The **shared** module consists of components shared across feature modules.
6+
7+
* The **core** module holds services shared across modules.
8+
9+
So core module is a module only having a services layer and shared module is a module only having a components layer.
10+
11+
The `SampleDataModule` which we visitied earlier is a typical example of a **feature** module
12+
13+
Let us refer the application again for examples on **core** module and **shared** module.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
An Angular application is component based like [devon4j](https://github.com/devonfw/devon4j), but different terminology is used as compared to devon4j. Primarily the term used is **module** instead of **component**.
2+
To clarify this:
3+
4+
* A **component** describes an UI element containing HTML, CSS and JavaScript - structure, design and logic encapsulated inside a reusable container called component.
5+
6+
* A **module** describes an applications feature area. The application flight-app may have a module called booking.
7+
8+
An application developed using Angular consists of multiple modules. There are feature modules and special modules - *core* and *shared*. Angular or Angular Styleguide give no guidance on how to structure a module internally. This is where this architecture comes in.
9+
10+
We will refer a devon4ng application for better understanding. But before that, let us understand the Architectural Layers of a devon4ng application.
30.6 KB
Loading

0 commit comments

Comments
 (0)