Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intégration géoplateforme #23

Open
wants to merge 12 commits into
base: geocat
Choose a base branch
from
1 change: 1 addition & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- geocat
- geocat-gpf # TEMP
release:
types: [published]
issue_comment:
Expand Down
83 changes: 6 additions & 77 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,108 +4,37 @@ run-name: 🚀 Deploy to GitHub Pages for ${{ github.event_name == 'issue_commen
env:
NODE_VERSION: 18.16.1

# This workflow runs whenever the "deploy affected apps" checkbox is checked (for PR)
# or on every push to main
# This workflow deploys the geoadmin demo app
on:
push:
branches:
- geocat
issue_comment:
types:
- edited

concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
- geocat-gpf

jobs:
checks:
if: github.event_name != 'issue_comment' || github.event.issue.pull_request
name: Check whether a deploy was requested on a PR
runs-on: ubuntu-latest
outputs:
shouldRun: ${{ github.event_name != 'issue_comment' || (contains(github.event.changes.body.from, '- [ ] 🚀 Build and deploy storybook and demo on GitHub Pages') && contains(github.event.comment.body, '- [x] 🚀 Build and deploy storybook and demo on GitHub Pages')) || '' }}
ref: ${{ github.event_name == 'issue_comment' && steps.comment-branch.outputs.head_ref || '' }}

steps:
- uses: xt0rted/pull-request-comment-branch@v1
if: github.event_name == 'issue_comment'
id: comment-branch

gh-pages:
needs: checks
if: github.event_name != 'issue_comment' || needs.checks.outputs.shouldRun
name: Deploy docs, apps, Storybook to GitHub Pages
name: Deploy geoadmin demo
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{needs.checks.outputs.ref || 'geocat'}}
BRANCH_NAME: ${{'geocat-gpf'}}

steps:
- name: Dump GitHub event
env:
GITHUB_CONTEXT: ${{ toJson(github.event) }}
run: echo "$GITHUB_CONTEXT"

- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ needs.checks.outputs.ref }}

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: add initial comment
uses: thollander/actions-comment-pull-request@v2
if: github.event_name == 'issue_comment'
with:
message: 'GitHub Pages links:


🚧 building in progress... 🚧'
comment_tag: github-links
pr_number: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install
run: npm ci

- name: Build storybook
run: npm run build:storybook

- name: Build demo & web components
run: npm run build:demo

- name: Build metadata-converter app
if: github.event_name != 'issue_comment' # This is not done on PR, only on main branch
run: npx nx build metadata-converter --prod --base-href=./

- name: Build docs
run: npm run docs:build -- --base=/geonetwork-ui/${{env.BRANCH_NAME}}/docs/ && mkdir -p dist/docs && mv docs/.vitepress/dist/* dist/docs

# FIXME: restore a system for testing web components but faster/lighter than storybook
# - name: Build storybook for web components
# run: npm run build:storybook-wc
- name: Build geoadmin-demo app
run: npx nx build geoadmin-demo --prod --base-href=./

- name: Deploy to directory ${{ env.BRANCH_NAME }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
npx gh-pages --dist dist/ --dest ${{env.BRANCH_NAME}} --remove "${{env.BRANCH_NAME}}/**" --no-history --repo "https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"

- name: update PR comment
uses: thollander/actions-comment-pull-request@v2
if: github.event_name == 'issue_comment'
with:
message: 'GitHub Pages links:

* (Documentation)[https://geonetwork.github.io/geonetwork-ui/${{env.BRANCH_NAME}}/docs/]

* (Web components demo)[https://geonetwork.github.io/geonetwork-ui/${{env.BRANCH_NAME}}/demo/webcomponents/]

* (UI components storybook)[https://geonetwork.github.io/geonetwork-ui/${{env.BRANCH_NAME}}/storybook/demo/]'
comment_tag: github-links
pr_number: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 9 additions & 5 deletions .github/workflows/webcomponents.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Web Components
run-name: 🧩 Build Web Components for ${{ github.event_name == 'issue_comment' && 'PR' || (github.event_name == 'release' && '🏷' || '🌱') }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.ref_name}}
run-name: 🧩 Build Web Components for ${{ github.event_name == 'issue_comment' && 'PR' || (github.event_name == 'release' && '🏷' || '🌱') }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.head_ref || github.ref_name}}

# This workflow runs whenever a commit is pushed on main or a release is published
on:
push:
branches:
- geocat
- main
tags:
- 'v*.*.*'
pull_request:
types: [opened, synchronize, ready_for_review]
release:
types: [published]

Expand All @@ -26,7 +30,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.checks.outputs.ref }}
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
fetch-depth: 0

Expand Down Expand Up @@ -54,10 +58,10 @@ jobs:
tag: ${{ github.ref }}
overwrite: true

- name: Publish web component to ${{ env.PUBLISH_BRANCH }} branch
- name: Publish web component to ${{ env.PUBLISH_BRANCH }}-${{ github.head_ref || github.ref_name }} branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./wc-dist
publish_branch: ${{ env.PUBLISH_BRANCH }}
publish_branch: ${{ env.PUBLISH_BRANCH }}-${{ github.head_ref || github.ref_name }}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
# OpenAPI generated specs
**/spec.yaml
/.nx

.angular
36 changes: 36 additions & 0 deletions apps/geoadmin-demo/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "geoadmin",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "geoadmin-root",
"style": "kebab-case"
}
]
},
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/geoadmin-demo/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'geoadmin-demo',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/apps/geoadmin-demo',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
}
101 changes: 101 additions & 0 deletions apps/geoadmin-demo/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "geoadmin-demo",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"prefix": "geonetwork-ui",
"sourceRoot": "apps/geoadmin-demo/src",
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/geoadmin-demo",
"index": "apps/geoadmin-demo/src/index.html",
"main": "apps/geoadmin-demo/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/geoadmin-demo/tsconfig.app.json",
"assets": [
"apps/geoadmin-demo/src/favicon.ico",
"apps/geoadmin-demo/src/assets"
],
"styles": ["apps/geoadmin-demo/src/styles.css"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "geoadmin-demo:build:production"
},
"development": {
"browserTarget": "geoadmin-demo:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "geoadmin-demo:build"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/geoadmin-demo/**/*.ts",
"apps/geoadmin-demo/**/*.html"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/geoadmin-demo/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "geoadmin-demo:build"
}
}
}
}
Empty file.
Binary file added apps/geoadmin-demo/src/favicon.ico
Binary file not shown.
Loading
Loading