diff --git a/.github/config/slack.yml b/.github/config/slack.yml deleted file mode 100644 index 98ab618..0000000 --- a/.github/config/slack.yml +++ /dev/null @@ -1,59 +0,0 @@ -username: GitHub-CI -icon_url: https://octodex.github.com/images/mona-the-rivetertocat.png - -pretext: Triggered via {{eventName}} by {{actor}} {{or action "action"}} {{ref}} `{{diffRef}}` -title: GitHub Actions -title_link: https://support.github.com - -text: | - *<{{workflowRunUrl}}|Workflow _{{workflow}}_ job _{{jobName}}_ triggered by _{{eventName}}_ is _{{jobStatus}}_>* for <{{refUrl}}|`{{ref}}`> - {{#if description}}<{{diffUrl}}|`{{diffRef}}`> - {{description}}{{/if}} - {{#if payload.commits}} - *Commits* - {{#each payload.commits}} - <{{this.url}}|`{{truncate this.id 8}}`> - {{this.message}} - {{/each}} - {{/if}} - -fallback: |- - [GitHub] {{workflow}} #{{runNumber}} {{jobName}} is {{jobStatus}} - -fields: - - title: Job Steps - value: "{{#each jobSteps}}{{icon this.outcome}} {{@key}}\n{{/each}}" - short: false - - title: Workflow - value: "<{{workflowUrl}}|{{workflow}}>" - short: true - - title: Git Ref - value: "{{ref}} ({{refType}})" - short: true - - title: Run ID - value: |- - <{{workflowRunUrl}}|{{runId}}> - short: true - - title: Run Number - value: "{{runNumber}}" - short: true - - title: Actor - value: "{{actor}}" - short: true - - title: Job Status - value: "{{jobStatus}}" - short: true - -footer: >- - <{{repositoryUrl}}|{{repositoryName}}> {{workflow}} #{{runNumber}} - -colors: - success: '#5DADE2' - failure: '#884EA0' - cancelled: '#A569BD' - default: '#7D3C98' - -icons: - success: ':white_check_mark:' - failure: ':grimacing:' - cancelled: ':x:' - skipped: ':heavy_minus_sign:' - default: ':interrobang:' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 92e446d..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] - schedule: - - cron: '22 16 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Use only 'java' to analyze code written in Java, Kotlin or both - # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - id: validation - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" - - - name: slack-send - # You may pin to the exact commit or the version. - uses: slackapi/slack-github-action@v1.23.0 - with: - payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Pull Request:* " - } - } - ], - "attachments": [ - { - "pretext": "Build result: *${{job.status}}* | ${{steps.validation.outcome}}", - "color": "dbab09", - "fields": [ - { - "title": "OS", - "short": true, - "value": "iOS" - }, - { - "title": "App Name", - "short": true, - "value": "Sonar" - }, - { - "title": "Version (Build)", - "short": true, - "value": "10.0.2 (22)" - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_URL_SLACK }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b542a30..0a85970 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,15 +9,62 @@ on: types: [opened, ready_for_review, synchronize, labeled, reopened] jobs: deploy: - if: ${{ contains(github.event.pull_request.labels.*.name, 'ready for test') }} - timeout-minutes: 15 - name: Build & Upload Mobile Application - runs-on: macos-latest + outputs: + jobstatus: ${{ job.status }} + if: contains(github.event.pull_request.labels.*.name, 'ready for test') + runs-on: ubuntu-latest + name: Build & Upload Web Application environment: name: Test + url: https://wn.repmvbx.xyz/ steps: - - name: Checkout code - uses: actions/checkout@v2.1.0 + - name: Checkout Code + uses: actions/checkout@v1 + - uses: actions/setup-node@v3 + with: + node-version: 16.18.0 + - name: Install Dependencies + run: npm ci + - name: Build Bundle + env: + CI: false + REACT_APP_USER_POOL_ID: ${{ secrets.USER_POOL_ID }} + REACT_APP_CLIENT_ID: ${{ secrets.CLIENT_ID }} + REACT_APP_API_URL: ${{ secrets.API_URL }} + REACT_APP_ENV: ${{ secrets.ENV }} + REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + run: | + npm run build + - name: Upload Bundle + uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read --delete + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SOURCE_DIR: "build" + - name: Invalidate CloudFront Distribution + uses: chetan/invalidate-cloudfront-action@master + env: + AWS_REGION: ${{ secrets.AWS_REGION }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + DISTRIBUTION: ${{ secrets.DISTRIBUTION }} + PATHS: '/*' + slack: + continue-on-error: true + needs: [deploy] + if: contains(github.event.pull_request.labels.*.name, 'ready for test') && ( failure() || success() ) + name: Slack Notification + runs-on: ubuntu-latest + steps: + - name: Checkout Code + if: + uses: actions/checkout@v1 + - name: Get build version info + run: | + echo "VERSION_INFORMATION=$(jq -c . < ./package.json)" >> $GITHUB_ENV - name: Send slack notification uses: slackapi/slack-github-action@v1.23.0 with: @@ -25,28 +72,44 @@ jobs: { "attachments": [ { - "pretext": "*Pull Request:* . Build result: *${{job.status}}*", + "pretext": "*Pull Request:* ", "color": "dbab09", "fields": [ { - "title": "OS", + "title": "Build result", "short": true, - "value": ":apple: iOS" + "value": "${{ needs.deploy.outputs.jobstatus }}" }, { "title": "App Name", "short": true, - "value": "Sonal" + "value": "Waveneuro consumer frontend" }, { - "title": "Version (Build)", + "title": "Version", "short": true, - "value": "${{ env.FL_BUILD_VERSION }} (${{ env.FL_BUILD_NUMBER }})" + "value": "${{ fromJson( env.VERSION_INFORMATION ).version }}" } ] } + ], + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Environment: *Test*" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Subscriptions tags: wn_frontend_${{ needs.deploy.outputs.jobstatus }}" + } + } ] } env: SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_URL_SLACK }} - + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/package.json b/package.json new file mode 100644 index 0000000..77bbd71 --- /dev/null +++ b/package.json @@ -0,0 +1,103 @@ +{ + "name": "commercial-frontend", + "version": "1.21.2", + "private": true, + "scripts": { + "start": "npm run test-env", + "test-env": "node scripts/removeSourceMapsWarning.js && NODE_ENV=test react-scripts start", + "dev-env": "node scripts/removeSourceMapsWarning.js && NODE_ENV=dev react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --coverage 'a'", + "eject": "react-scripts eject", + "lint": "eslint src/**/*.ts*", + "lint:fix": "eslint src/**/*.ts* --fix", + "prettier": "prettier --check src/**", + "prettier:fix": "prettier --write src/**" + }, + "dependencies": { + "@sentry/react": "^7.16.0", + "@sentry/tracing": "^7.16.0", + "@szhsin/react-menu": "^1.10.1", + "@testing-library/jest-dom": "^5.12.0", + "@testing-library/react": "^12.1.5", + "@types/lodash.isequal": "^4.5.5", + "@types/ramda": "^0.27.61", + "@types/react": "^17.0.4", + "@types/react-avatar-editor": "^10.3.6", + "@types/react-datepicker": "^4.8.0", + "@types/react-dom": "^17.0.3", + "@types/react-input-mask": "^3.0.1", + "@types/react-modal": "^3.12.0", + "@types/react-router-dom": "^5.1.7", + "@types/react-select": "^4.0.15", + "@types/react-table": "^7.7.0", + "@types/react-toggle": "^4.0.2", + "@typescript-eslint/eslint-plugin": "^4.22.0", + "@typescript-eslint/parser": "^4.22.0", + "amazon-cognito-identity-js": "^6.0.1", + "autoprefixer": "^9.8.6", + "axios": "^0.21.2", + "babel-eslint": "^10.1.0", + "date-fns": "^2.22.1", + "eslint-config-airbnb": "^18.2.1", + "eslint-config-prettier": "^8.3.0", + "eslint-config-react-app": "^6.0.0", + "eslint-import-resolver-typescript": "^2.4.0", + "eslint-plugin-flowtype": "^5.7.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^3.4.0", + "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react-hooks": "^4.2.0", + "formik": "^2.2.6", + "history": "^5.3.0", + "html-to-image": "^1.7.0", + "jspdf": "^2.3.1", + "lodash.isequal": "^4.5.0", + "mockdate": "^3.0.5", + "postcss-flexbugs-fixes": "^5.0.2", + "postcss-preset-env": "^7.8.3", + "prettier": "2.2.1", + "ramda": "^0.27.1", + "react": "^17.0.2", + "react-avatar-editor": "^12.0.0", + "react-datepicker": "^4.8.0", + "react-day-picker": "^7.4.10", + "react-debounce-input": "^3.2.5", + "react-dom": "^17.0.2", + "react-dropzone": "^11.5.1", + "react-helmet-async": "^1.0.9", + "react-idle-timer": "^5.2.0", + "react-infinite-scroll-component": "^6.1.0", + "react-input-mask": "^2.0.4", + "react-input-pin-code": "^1.2.0", + "react-loader-spinner": "^4.0.0", + "react-modal": "^3.13.1", + "react-qr-code": "^2.0.7", + "react-router": "^5.2.0", + "react-router-dom": "^5.2.0", + "react-scripts": "^5.0.1", + "react-select": "^4.3.1", + "react-spinners": "^0.11.0", + "react-table": "^7.7.0", + "react-toastify": "^7.0.4", + "react-toggle": "^4.1.2", + "react-tooltip": "^4.2.19", + "recharts": "^2.4.1", + "tailwindcss": "^3.2.4", + "typescript": "^4.2.4", + "yup": "^0.32.9" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +}