Skip to content

Commit

Permalink
feat: packages angular and web (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
esoubiran-aneo authored Feb 22, 2023
1 parent 822ea77 commit 023bf41
Show file tree
Hide file tree
Showing 38 changed files with 24,518 additions and 499 deletions.
73 changes: 36 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,61 +97,60 @@ jobs:
- name: Check Diff
run: docker run --rm --volume "$(pwd)/Protos/V1:/workspace" --workdir /workspace bufbuild/buf:1.8.0 format -d --exit-code

build-angular:
name: Build Angular
build-web:
name: Build Web
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/web
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: Cache Node Modules
id: node-cache
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('yarn.lock') }}

- name: Cache Protos
id: proto-cache
uses: actions/cache@v3
with:
path: packages/angular
key: protobuf-${{ hashFiles('Protos/V1/*.proto') }}
cache: npm

- name: Install Dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: yarn --immutable
run: npm ci

- name: Install Protoc
if: steps.proto-cache.outputs.cache-hit != 'true'
uses: arduino/setup-protoc@v1
run: sudo apt install -y protobuf-compiler

- name: Build protos
if: steps.proto-cache.outputs.cache-hit != 'true'
run: yarn proto:generate:linux
run: npm run proto:generate:linux

- name: Check index.ts
run: yarn build
- name: Build
run: npm run build

build-documentation:
name: Build Documentation
runs-on: ubuntu-20.04
build-angular:
name: Build Angular
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/angular
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate protobuf documentation
uses: addnab/docker-run-action@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
image: pseudomuto/protoc-gen-doc
options: -v ${{ github.workspace }}/Documentation/api:/out -v ${{ github.workspace }}/Protos/V1:/protos
run: |
protoc -I/usr/include -Iprotos --doc_out=/out --doc_opt=markdown,index.md protos/*.proto
node-version: 18.x
cache: npm

- name: Install Dependencies
run: npm ci

- name: Install Protoc
run: sudo apt install -y protobuf-compiler

- name: Build protos
run: npm run proto:generate:linux

- name: Build
run: npm run build
46 changes: 42 additions & 4 deletions .github/workflows/publish-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,62 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
registry-url: https://registry.npmjs.org/

- name: Install ni
run: npm i -g @antfu/ni pnpm

- name: Install dependencies
run: nci
run: cd packages/angular && nci && cd ../..

- name: Install Protoc
uses: arduino/setup-protoc@v1
run: sudo apt install -y protobuf-compiler

- name: Build protos
run: nr proto:generate:linux
run: cd packages/angular && nr proto:generate:linux && cd ../..

- name: Update version
run: nr update-versions $VERSION

- name: Release package
run: nr ci:publish-edge
run: nr ci:publish-edge angular dist/aneoconsultingfr/armonik.api.angular
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

release-web-package:
if: github.ref == 'refs/heads/main'
needs: [create-version]
name: Release Web Package
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.create-version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install ni
run: npm i -g @antfu/ni pnpm

- name: Install dependencies
run: cd packages/web && nci && cd ../..

- name: Install Protoc
run: sudo apt install -y protobuf-compiler

- name: Build protos
run: cd packages/web && nr proto:generate:linux && cd ../..

- name: Update version
run: nr update-versions $VERSION

- name: Release package
run: nr ci:publish-edge web
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
39 changes: 35 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,53 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
registry-url: https://registry.npmjs.org/

- name: Install ni
run: npm i -g @antfu/ni pnpm

- name: Install dependencies
run: nci
run: cd packages/angular && nci && cd ../..

- name: Install Protoc
uses: arduino/setup-protoc@v1
run: sudo apt install -y protobuf-compiler

- name: Build protos
run: nr proto:generate:linux
run: cd packages/angular && nr proto:generate:linux && cd ../..

- name: Release package
run: nr ci:publish
run: nr ci:publish angular dist/aneoconsultingfr/armonik.api.angular
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

release-web-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
registry-url: https://registry.npmjs.org/

- name: Install ni
run: npm i -g @antfu/ni pnpm

- name: Install dependencies
run: cd packages/web && nci && cd ../..

- name: Install Protoc
run: sudo apt install -y protobuf-compiler

- name: Build protos
run: cd packages/web && nr proto:generate:linux && cd ../..

- name: Release package
run: nr ci:publish web
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ dist
!packages/csharp
!packages/python
!packages/angular
!packages/web
packages/web/LICENSE

!.docs/content/**

Expand Down
53 changes: 0 additions & 53 deletions index.ts

This file was deleted.

22 changes: 1 addition & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
{
"name": "@aneoconsultingfr/armonik.api",
"version": "3.4.0",
"name": "armonik.api",
"packageManager": "[email protected]",
"description": "gRPC API to interact with ArmoniK",
"main": "index.ts",
"files": [
"index.ts",
"./packages/angular/*.ts"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"ci:publish": "zx scripts/publish.mjs",
"ci:publish-edge": "zx scripts/publish-edge.mjs",
"build": "tsc --noEmit index.ts",
"proto:generate:linux": "protoc --plugin=protoc-gen-ng=$(which protoc-gen-ng) --ng_out=./packages/angular -I ./Protos/V1 ./Protos/V1/*.proto",
"update-versions": "jiti ./scripts/update-versions.ts",
"verify-versions": "jiti ./scripts/verify-versions.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/aneoconsulting/ArmoniK.Api.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/aneoconsulting/ArmoniK.Api/issues"
},
"homepage": "https://github.com/aneoconsulting/ArmoniK.Api#readme",
"devDependencies": {
"@ngx-grpc/protoc-gen-ng": "^3.1.1",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"consola": "^2.15.3",
"eslint": "^8.32.0",
Expand Down
16 changes: 16 additions & 0 deletions packages/angular/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
44 changes: 44 additions & 0 deletions packages/angular/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db

LICENSE
4 changes: 4 additions & 0 deletions packages/angular/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}
Loading

0 comments on commit 023bf41

Please sign in to comment.