-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f5c46
commit 33bd16a
Showing
8 changed files
with
1,159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
delete-comments: | ||
name: Delete bot comment(s) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: izhangzhihao/delete-comment@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
delete_user_name: github-actions[bot] | ||
issue_number: ${{ github.event.number }} | ||
|
||
branch-naming-rules: | ||
name: Check branch name | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: deepakputhraya/action-branch-name@master | ||
with: | ||
regex: '^(feature|bugfix|improvement|library|prerelease|release|hotfix)\/[a-z0-9_.-]+$' | ||
allowed_prefixes: 'feature,bugfix,improvement,library,prerelease,release,hotfix' | ||
ignore: main,dev | ||
min_length: 5 | ||
max_length: 50 | ||
|
||
build: | ||
name: Setup app | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.14 | ||
- name: Setup npm | ||
run: npm install -g [email protected] | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('./package-lock.json') }} | ||
- name: Install dependencies | ||
run: npm ci | ||
- run: git status | ||
- name: Set node_modules cache | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('./package-lock.json') }} | ||
|
||
check-style: | ||
name: Code style | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.14 | ||
- name: Setup npm | ||
run: npm install -g [email protected] | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('./package-lock.json') }} | ||
- name: Check style | ||
run: npm run lint | ||
|
||
unit-tests: | ||
name: Unit tests | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.14 | ||
- name: Setup npm | ||
run: npm install -g [email protected] | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('./package-lock.json') }} | ||
- name: Run unit tests | ||
run: export NODE_OPTIONS=--max_old_space_size=8192 && npm run test | ||
- name: Upload line coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: reports-lcov-${{ github.sha }} | ||
path: reports/ | ||
|
||
check-dependencies: | ||
name: Check dependencies | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.14 | ||
- name: Setup npm | ||
run: npm install -g [email protected] | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('./package-lock.json') }} | ||
- name: Install dependencies | ||
run: npm install npm-check-updates | ||
- name: Run check dependencies | ||
run: echo '```bash' > dependencies.txt && npx ncu -x "leto-modelizer*" >> dependencies.txt && echo '```' >> dependencies.txt | ||
- name: Post comment | ||
uses: machine-learning-apps/pr-comment@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
path: dependencies.txt | ||
|
||
sonarcloud: | ||
name: SonarCloud | ||
needs: [check-style, unit-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Disabling shallow clone is recommended for improving relevancy of reporting | ||
fetch-depth: 0 | ||
- name: Download line coverage report | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: reports-lcov-${{ github.sha }} | ||
path: reports/ | ||
- name: SonarCloud Scan | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
|
||
e2e-tests: | ||
name: E2E tests | ||
needs: [sonarcloud] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.14 | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('./package-lock.json') }} | ||
- name: Build application | ||
run: | | ||
npm install -g [email protected] && \ | ||
npm ci && \ | ||
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.2.5" && \ | ||
npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.7.0" && \ | ||
npm run plugin:init && \ | ||
docker build -t leto-modelizer -f DockerfileE2E . | ||
- name: Run application | ||
run: docker run -p 8080:80 -d leto-modelizer | ||
- name: Run functional tests | ||
run: npm run test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: dev-cm-js | ||
data: | ||
env.js: | | ||
window.env = { | ||
ENVIRONMENT: 'development', | ||
CONTACT_US: 'CONTACT', | ||
CONNECT_ENVIRONMENT:'development', | ||
CONNECT_CLIENT_ID:'1234567890', | ||
CONNECT_ENDPOINT:'localhost' , | ||
CONNECT_SCOPE:'openid mail profile', | ||
CONNECT_REDIRECT_URI:'localhost:8080/redirect' , | ||
CONNECT_BASE_URL: '', | ||
ENABLE_SPLASH_SCREEN:false | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: dev-cm-nginx | ||
data: | ||
nginx.conf: | | ||
ssl_ciphers '1234567890'; | ||
ssl_protocols TLSv1.1 TLSv1.2; | ||
add_header X-Content-Type-Options nosniff; | ||
add_header X-XSS-Protection "1; mode=block"; | ||
add_header X-Frame-Options SAMEORIGIN; | ||
server_tokens off; | ||
ignore_invalid_headers off; | ||
#log_format test '$http_givenName ' '$http_cn ' '$http_C ' ' '$http_uId ' "$http_role.0"; | ||
server { | ||
listen 8080; | ||
client_max_body_size 30; | ||
listen [::]:8080; | ||
root /home/app/src/; | ||
server_name ~.*plop; | ||
location / { | ||
try_files $uri $uri/ /index.html; | ||
alias /home/app/src/; | ||
add_header Cache-Control 'no-cache, no-store'; | ||
add_header Pragma 'no-cache'; | ||
} | ||
location /index.html { | ||
expires 0; | ||
add_header Pragma 'no-cache'; | ||
add_header Cache-Control 'no-cache, no-store, must-revalidate'; | ||
} | ||
location /nginx_status { | ||
stub_status on; | ||
access_log off; | ||
allow 127.0.0.1; | ||
allow ::1; | ||
deny all; | ||
} | ||
location /api { | ||
proxy_pass http://localhost:8080; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
add_header Cache-Control 'no-cache, no-store'; | ||
add_header Pragma 'no-cache'; | ||
proxy_read_timeout 300; | ||
proxy_send_timeout 300; | ||
proxy_connect_timeout 300; | ||
proxy_ignore_client_abort on; | ||
} | ||
access_log /dev/stdout main; | ||
error_log /dev/stdout; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: frontend-dev | ||
app.kubernetes.io/component: frontend | ||
name: frontend-dev-deployment | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: frontend-dev | ||
app.kubernetes.io/component: frontend | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: frontend-dev | ||
app.kubernetes.io/component: frontend | ||
spec: | ||
containers: | ||
- image: localhost:IMAGE_TAG | ||
imagePullPolicy: Always | ||
name: frontend-dev-cn | ||
ports: | ||
- containerPort: 8080 | ||
protocol: TCP | ||
resources: | ||
limits: | ||
cpu: 300m | ||
memory: 1Gi | ||
requests: | ||
cpu: 100m | ||
memory: 1Gi | ||
volumeMounts: | ||
- mountPath: /etc/nginx/conf.d | ||
name: cm-nginx | ||
- mountPath: /home/toto/plop | ||
name: cm-js | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
securityContext: {} | ||
volumes: | ||
- configMap: | ||
name: dev-cm-nginx | ||
name: cm-nginx | ||
- configMap: | ||
name: dev-cm-js | ||
name: cm-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
kubernetes.io/ingress.allow-http: "true" | ||
kubernetes.io/ingress.class: ns-aog-a8576-dev-hom | ||
nginx.ingress.kubernetes.io/ssl-passthrough: "false" | ||
nginx.ingress.kubernetes.io/backend-protocol: HTTP | ||
nginx.ingress.kubernetes.io/proxy-connect-timeout: "300" | ||
nginx.ingress.kubernetes.io/proxy-send-timeout: "300" | ||
nginx.ingress.kubernetes.io/proxy-read-timeout: "300" | ||
name: dev-ingress | ||
spec: | ||
tls: | ||
- hosts: | ||
- localhost | ||
secretName: secret | ||
rules: | ||
- host: localhost | ||
http: | ||
paths: | ||
- pathType: Prefix | ||
path: / | ||
backend: | ||
service: | ||
name: dev-svc | ||
port: | ||
number: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: dev-svc | ||
labels: | ||
app.kubernetes.io/name: frontend-dev | ||
app.kubernetes.io/component: frontend | ||
spec: | ||
ports: | ||
- name: 8080-tcp | ||
port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app.kubernetes.io/name: frontend-dev | ||
app.kubernetes.io/component: frontend | ||
type: ClusterIP |
Oops, something went wrong.