Skip to content

Commit

Permalink
NSM Dashboard initial impl.
Browse files Browse the repository at this point in the history
Signed-off-by: Vitaliy Guschin <[email protected]>
  • Loading branch information
Vitaliy Guschin committed Dec 6, 2023
1 parent b51c987 commit 2454d5a
Show file tree
Hide file tree
Showing 37 changed files with 4,455 additions and 352 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
26 changes: 3 additions & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,8 @@ jobs:
shellcheck:
uses: networkservicemesh/.github/.github/workflows/shellcheck.yaml@main

golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main

excludeFmtErrorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main

restrictNSMDeps:
uses: networkservicemesh/.github/.github/workflows/restrict-nsm-deps.yaml@main
with:
allowed_repositories: "api, sdk, sdk-k8s, sdk-kernel, sdk-sriov, sdk-vpp, govpp, vpphelper"

checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main

gogenerate:
uses: networkservicemesh/.github/.github/workflows/cmd-gogenerate.yaml@main

excludereplace:
uses: networkservicemesh/.github/.github/workflows/exclude-replace.yaml@main
react-lint:
uses: networkservicemesh/cmd-dashboard-ui/.github/workflows/react-lint.yml@main

docker-build-and-test:
if: github.repository != 'networkservicemesh/cmd-template'
uses: networkservicemesh/.github/.github/workflows/docker-build-and-test.yaml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
uses: networkservicemesh/cmd-dashboard-ui/.github/workflows/docker-build-and-test-react.yml@main
20 changes: 0 additions & 20 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/docker-build-and-test-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: React Build & Test

on:
workflow_call:
secrets:
token:
required: true

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Install dependencies
run: npm install

- name: Build Docker image
run: docker build -t dashboard-ui .

- name: Run tests
run: |
docker run --rm -d -p 3000:3000 --name dashboard-ui-container dashboard-ui
sleep 10 # Wait for the application to start
docker exec dashboard-ui-container curl -I http://localhost:3000
docker stop dashboard-ui-container
- name: Cleanup
run: docker rmi dashboard-ui
13 changes: 0 additions & 13 deletions .github/workflows/docker-push.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/react-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: React lint

on:
workflow_call:

jobs:
react-lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Install dependencies
run: npm install

- name: Run lint
run: npm run lint
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,16 @@ jobs:
echo tag=${branch#release/} >> $GITHUB_OUTPUT
id: get-tag-step

check-gomod-deps:
needs: get-tag
uses: networkservicemesh/.github/.github/workflows/check-gomod-deps.yaml@main
with:
tag: ${{ needs.get-tag.outputs.tag }}

create-release:
needs: [get-tag, check-gomod-deps]
needs: [get-tag]
uses: networkservicemesh/.github/.github/workflows/release.yaml@main
with:
tag: ${{ needs.get-tag.outputs.tag }}
secrets:
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}

docker:
needs: [get-tag, check-gomod-deps]
needs: [get-tag]
uses: networkservicemesh/.github/.github/workflows/docker-release.yaml@main
with:
tag: ${{ needs.get-tag.outputs.tag }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/update-cmd-repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ jobs:
allow-files-pattern: (.*\.yaml|.*\.yml|.*\.txt|.*\.md|.*\.conf)
exclude-files: |
.github/workflows/update-cmd-repositories.yaml
.golangci.yml
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@

.idea/
junit/
node_modules
build
nohup.out
.DS_Store
.vscode
166 changes: 0 additions & 166 deletions .golangci.yml

This file was deleted.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.9.0
22 changes: 5 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
FROM golang:1.20.5-buster as go
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOBIN=/bin
RUN go install github.com/go-delve/delve/cmd/[email protected]
ADD https://github.com/spiffe/spire/releases/download/v1.2.2/spire-1.2.2-linux-x86_64-glibc.tar.gz .
RUN tar xzvf spire-1.2.2-linux-x86_64-glibc.tar.gz -C /bin --strip=2 spire-1.2.2/bin/spire-server spire-1.2.2/bin/spire-agent
FROM node:20.9.0

FROM go as build
WORKDIR /build
WORKDIR /app
COPY . .
RUN go build -o /bin/app .

FROM build as test
CMD go test -test.v ./...
RUN npm install

FROM test as debug
CMD dlv -l :40000 --headless=true --api-version=2 test -test.v ./...
EXPOSE 3000

FROM alpine as runtime
COPY --from=build /bin/app /bin/app
CMD /bin/app
CMD ["npm", "run", "dev"]
Loading

0 comments on commit 2454d5a

Please sign in to comment.