Skip to content

Commit

Permalink
Merge pull request #798 from cloud-pi-native/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
this-is-tobi authored Nov 13, 2023
2 parents bbb002b + 8c49d49 commit 5f14cdd
Show file tree
Hide file tree
Showing 113 changed files with 5,555 additions and 1,593 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ on:
types:
- closed
workflow_dispatch:
inputs:
PR_NUMBER:
description: ID number of the pull request assiocited with the cache
required: false
type: number
BRANCH_NAME:
description: Branch name assiocited with the cache
required: false
type: string

jobs:
cleanup-cache:
Expand All @@ -19,7 +28,11 @@ jobs:
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
if [ -n "${{ inputs.BRANCH_NAME }}" ]; then
BRANCH="${{ inputs.BRANCH_NAME }}"
else
BRANCH="refs/pull/${{ github.event.pull_request.number || inputs.PR_NUMBER }}/merge"
fi
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
Expand All @@ -37,6 +50,7 @@ jobs:
matrix:
name: Generate matrix for build & scan
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.number || github.event.number }}
outputs:
build-matrix: ${{ steps.build-matrix.outputs.BUILD_MATRIX }}
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
workflow_dispatch:

env:
NODE_VERSION: "18.18.0"
NODE_VERSION: "20.9.0"
PNPM_VERSION: "8"
REGISTRY: "ghcr.io"
NAMESPACE: "${{ github.repository }}"
Expand Down Expand Up @@ -82,6 +82,7 @@ jobs:
with:
NODE_VERSION: ${{ needs.expose-vars.outputs.NODE_VERSION }}
PNPM_VERSION: ${{ needs.expose-vars.outputs.PNPM_VERSION }}
BROWSERS: "${{ github.base_ref == 'main' && 'electron,firefox' || 'electron' }}"

build:
uses: ./.github/workflows/build.yml
Expand All @@ -105,6 +106,7 @@ jobs:
NODE_VERSION: ${{ needs.expose-vars.outputs.NODE_VERSION }}
PNPM_VERSION: ${{ needs.expose-vars.outputs.PNPM_VERSION }}
TAG: pr-${{ github.event.pull_request.number || github.event.number }}
BROWSERS: "${{ github.base_ref == 'main' && 'electron,firefox' || 'electron' }}"

deploy-tests:
uses: ./.github/workflows/tests-deploy.yml
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ on:
PNPM_VERSION:
required: false
type: string
workflow_dispatch:
inputs:
NODE_VERSION:
description: Nodejs version used to run tests
required: true
type: string
default: "18.18.0"
PNPM_VERSION:
description: Pnpm version used to run tests
required: true
type: string
default: "8"

jobs:
lint:
Expand Down
56 changes: 53 additions & 3 deletions .github/workflows/tests-component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,48 @@ on:
PNPM_VERSION:
required: true
type: string
BROWSERS:
required: true
type: string
workflow_dispatch:
inputs:
NODE_VERSION:
description: Nodejs version used to run tests
required: true
type: string
default: "18.18.0"
PNPM_VERSION:
description: Pnpm version used to run tests
required: true
type: string
default: "8"
BROWSERS:
description: Comma separeted browser list to run tests on (Options are 'electron', 'chrome', 'edge', 'firefox')
required: false
type: string
default: "electron"

jobs:
unit-tests:
matrix:
name: Generate browsers matrix
runs-on: ubuntu-latest
outputs:
browsers: ${{ steps.build-matrix.outputs.BROWSERS }}
steps:
- name: Generate matrix for build
id: build-matrix
run: |
BROWSERS=$(echo "\"${{ inputs.BROWSERS }}\"" | jq -c 'split(",")')
echo "BROWSERS=$BROWSERS" >> $GITHUB_OUTPUT
component-tests:
name: Component tests
runs-on: ubuntu-latest
needs:
- matrix
strategy:
matrix:
browsers: ${{ fromJson(needs.matrix.outputs.browsers) }}
steps:
- name: Checks-out repository
uses: actions/checkout@v3
Expand All @@ -30,6 +67,18 @@ jobs:
with:
node-version: "${{ inputs.NODE_VERSION }}"

- name: Setup firefox
uses: browser-actions/setup-firefox@v1
if: ${{ matrix.browsers == 'firefox' }}

- name: Setup chrome
uses: browser-actions/setup-chrome@v1
if: ${{ matrix.browsers == 'chrome' }}

- name: Setup edge
uses: browser-actions/setup-edge@v1
if: ${{ matrix.browsers == 'edge' }}

- name: Get pnpm store directory
id: pnpm-store
run: |
Expand All @@ -50,8 +99,9 @@ jobs:
with:
path: |
./.turbo/cache
key: turbo-component-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('apps/**/src/**','packages/**/src/**') }}
key: turbo-component-${{ runner.os }}-${{ runner.arch }}-${{ matrix.browsers }}-${{ hashFiles('apps/**/src/**','apps/client/cypress/**','packages/**/src/**') }}
restore-keys: |
turbo-component-${{ runner.os }}-${{ runner.arch }}-${{ matrix.browsers }}-
turbo-component-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
Expand All @@ -60,7 +110,7 @@ jobs:
- name: Run component tests
run: |
./ci/scripts/init-env.sh
./ci/scripts/run-tests.sh -c
./ci/scripts/run-tests.sh -c -b "${{ matrix.browsers }}"
- name: Upload cypress artifacts
if: ${{ failure() }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/tests-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
TAG:
required: true
type: string
workflow_dispatch:
inputs:
TAG:
description: Image tag used ti run tests
required: true
type: string
default: "latest"

jobs:
deploy-check:
Expand Down
59 changes: 57 additions & 2 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,53 @@ on:
TAG:
required: true
type: string
BROWSERS:
required: true
type: string
workflow_dispatch:
inputs:
NODE_VERSION:
description: Nodejs version used to run tests
required: true
type: string
default: "18.18.0"
PNPM_VERSION:
description: Pnpm version used to run tests
required: true
type: string
default: "8"
TAG:
description: Image tag used to run tests
required: true
type: string
default: "latest"
BROWSERS:
description: Comma separeted browser list to run tests on (Options are 'electron', 'chrome', 'edge', 'firefox')
required: false
type: string
default: "electron"

jobs:
matrix:
name: Generate browsers matrix
runs-on: ubuntu-latest
outputs:
browsers: ${{ steps.build-matrix.outputs.BROWSERS }}
steps:
- name: Generate matrix for build
id: build-matrix
run: |
BROWSERS=$(echo "\"${{ inputs.BROWSERS }}\"" | jq -c 'split(",")')
echo "BROWSERS=$BROWSERS" >> $GITHUB_OUTPUT
e2e-tests:
name: End to end tests
runs-on: ubuntu-latest
needs:
- matrix
strategy:
matrix:
browsers: ${{ fromJson(needs.matrix.outputs.browsers) }}
steps:
- name: Checks-out repository
uses: actions/checkout@v3
Expand All @@ -33,6 +75,18 @@ jobs:
with:
node-version: "${{ inputs.NODE_VERSION }}"

- name: Setup firefox
uses: browser-actions/setup-firefox@v1
if: ${{ matrix.browsers == 'firefox' }}

- name: Setup chrome
uses: browser-actions/setup-chrome@v1
if: ${{ matrix.browsers == 'chrome' }}

- name: Setup edge
uses: browser-actions/setup-edge@v1
if: ${{ matrix.browsers == 'edge' }}

- name: Get pnpm store directory
id: pnpm-store
run: |
Expand All @@ -53,8 +107,9 @@ jobs:
with:
path: |
./.turbo/cache
key: turbo-e2e-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('apps/**/src/**','packages/**/src/**') }}
key: turbo-e2e-${{ runner.os }}-${{ runner.arch }}-${{ matrix.browsers }}-${{ hashFiles('apps/**/src/**','apps/client/cypress/**','packages/**/src/**') }}
restore-keys: |
turbo-e2e-${{ runner.os }}-${{ runner.arch }}-${{ matrix.browsers }}-
turbo-e2e-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
Expand All @@ -63,7 +118,7 @@ jobs:
- name: Run e2e tests
run: |
./ci/scripts/init-env.sh
./ci/scripts/run-tests.sh -e -t "${{ inputs.TAG }}"
./ci/scripts/run-tests.sh -e -t "${{ inputs.TAG }}" -b "${{ matrix.browsers }}"
- name: Upload cypress artifacts
if: ${{ failure() }}
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ on:
required: false
SONAR_PROJECT_KEY:
required: false
workflow_dispatch:
inputs:
NODE_VERSION:
description: Nodejs version used to run tests
required: true
type: string
default: "18.18.0"
PNPM_VERSION:
description: Pnpm version used to run tests
required: true
type: string
default: "8"

jobs:
unit-tests:
Expand Down Expand Up @@ -154,6 +166,12 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Set sonarqube args
id: sonar-args
run: |
echo "SONAR_ARGS_PR=-Dsonar.pullrequest.provider=github -Dsonar.pullrequest.key=${{ github.event.number }} -Dsonar.pullrequest.branch=${{ github.head_ref }} -Dsonar.pullrequest.base=${{ github.base_ref }} -Dsonar.pullrequest.github.repository=${{ github.repository }}" >> $GITHUB_OUTPUT
echo "SONAR_ARGS_BRANCH=-Dsonar.branch.name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
Expand All @@ -168,12 +186,7 @@ jobs:
-Dsonar.javascript.lcov.reportPaths=coverage/apps/server/coverage/lcov.info,coverage/apps/client/coverage/lcov.info,coverage/packages/shared/coverage/lcov.info
-Dsonar.coverage.exclusions=**/*.spec.js,**/*.spec.ts,**/*.vue,**/assets/**,**/cypress/**,**/packages/test-utils/**,apps/server/src/plugins/**
-Dsonar.scm.provider=git
-Dsonar.pullrequest.provider=github
-Dsonar.pullrequest.key=${{ github.event.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
-Dsonar.pullrequest.github.repository=${{ github.repository }}
# -Dsonar.branch.name=${{ github.event.pull_request.head.ref }}
${{ github.event_name == 'pull_request' && steps.sonar-args.outputs.SONAR_ARGS_PR || steps.sonar-args.outputs.SONAR_ARGS_BRANCH }}
continue-on-error: true

- name: SonarQube Quality Gate check
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"projectInit"
],
"sonarlint.connectedMode.project": {
"connectionId": "https://test-sonarqube.osc-secnum-fr1.scalingo.io",
"projectKey": "dso-console"
"connectionId": "https://sonarqube.fabrique-numerique.fr",
"projectKey": "cloud-pi-native_console_AYsa46O31ebDtzs-pYyZ"
},
}
2 changes: 1 addition & 1 deletion apps/client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"vue/setup-compiler-macros": true,
"cypress/globals": true,
"browser": true,
"es2022": true
"es2023": true
},
"rules": {
"vue/no-v-html": 0,
Expand Down
2 changes: 1 addition & 1 deletion apps/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dev stage
FROM docker.io/node:18.18.0-bullseye-slim AS dev
FROM docker.io/node:20.9.0-bullseye-slim AS dev

WORKDIR /app
RUN npm install --location=global [email protected]
Expand Down
16 changes: 8 additions & 8 deletions apps/client/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { defineConfig } from 'cypress'
import viteConfig from './vite.config'

const argocdUrl = process.env.ARGOCD_URL || 'https://argo-cd.readthedocs.io'
const gitlabUrl = process.env.GITLAB_URL || 'https://gitlab.com'
const harborUrl = process.env.HARBOR_URL || 'https://goharbor.io'
const nexusUrl = process.env.NEXUS_URL || 'https://sonatype.com/products/nexus-repository'
const sonarqubeUrl = process.env.SONARQUBE_URL || 'https://www.sonarqube.org'
const vaultUrl = process.env.VAULT_URL || 'https://www.vaultproject.io'
const clientHost = process.env.CLIENT_HOST || 'localhost'
const clientPort = process.env.CLIENT_PORT || '8080'
const argocdUrl = process.env.ARGOCD_URL ?? 'https://argo-cd.readthedocs.io'
const gitlabUrl = process.env.GITLAB_URL ?? 'https://gitlab.com'
const harborUrl = process.env.HARBOR_URL ?? 'https://goharbor.io'
const nexusUrl = process.env.NEXUS_URL ?? 'https://sonatype.com/products/nexus-repository'
const sonarqubeUrl = process.env.SONARQUBE_URL ?? 'https://www.sonarqube.org'
const vaultUrl = process.env.VAULT_URL ?? 'https://www.vaultproject.io'
const clientHost = process.env.CLIENT_HOST ?? 'localhost'
const clientPort = process.env.CLIENT_PORT ?? '8080'

// @ts-ignore server does exist!
viteConfig.server.host = '127.0.0.1'
Expand Down
Loading

0 comments on commit 5f14cdd

Please sign in to comment.