Ver código fonte

init gitlab-ci

Olivier Massot 2 anos atrás
pai
commit
989cf477a2
2 arquivos alterados com 45 adições e 1 exclusões
  1. 43 0
      .gitlab-ci.yaml
  2. 2 1
      vitest.config.ts

+ 43 - 0
.gitlab-ci.yaml

@@ -0,0 +1,43 @@
+stages:
+  - test
+
+variables:
+  APP_ENV: ci
+  SSH_PRIVATE_KEY: $SSH_PRIVATE_KEY
+
+before_script:
+  - apt-get -yqq update
+  - apt-get -yqq install zip unzip git openssh-client
+
+  # Run ssh-agent and add private key
+  - eval $(ssh-agent -s)
+  - mkdir -p ~/.ssh
+  - chmod 700 ~/.ssh
+  - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
+  - ssh-add <(echo "$SSH_PRIVATE_KEY")
+  - git config --global user.email "exploitation@opentalent.fr"
+  - git config --global user.name "git"
+
+  # install yarn
+  - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
+  - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
+
+cache:
+  paths:
+    - ./node_modules
+
+unit:
+  stage: test
+
+  script:
+    - yarn install
+    - yarn test
+
+  artifacts:
+    paths:
+      - ./coverage/
+    when: always
+    reports:
+      coverage_report:
+        coverage_format: cobertura
+        path: coverage/cobertura-coverage.xml

+ 2 - 1
vitest.config.ts

@@ -16,7 +16,8 @@ export default defineConfig({
                 'services/**',
             ],
             all: true,
-            extension: ['.ts', '.vue']
+            extension: ['.ts', '.vue'],
+            reporter: ['html', 'json', 'text', 'cobertura']
         }
     },
     resolve: {