NUnit 具有魅力集成 CI/Gitlab

问题描述 投票:0回答:0

有一个项目,Nunit 在其上进行测试,并连接了 Allure。我无法理解需要在 .gitlab-ci.yml 中编写什么才能生成 allure 报告(它位于本地 /bin/Debug/net6.0/allure-results 中,并且 allureserve allure-results 命令有效完美,但是在 Gitlab 中是怎么做的,我不明白)。

这是我的 .gitlab-ci.yml (它运行测试并且它们通过)。

image: mcr.microsoft.com/dotnet/sdk:6.0
variables:
  ASPNETCORE_ENVIRONMENT: "appsettings.test.json"
stages:
  - build
  - test
  - reports
  - deploy

build:
  stage: build
  script:
    - dotnet build

test:
  stage: test
  script:
    - mkdir -p /app/Settings
    - cp "My Project/Settings/appsettings.test.json" /app/Settings
    - cd "My Project"
    - dotnet test
  artifacts:
    paths:
      - My Project/bin/Debug/net6.0/allure-results/
    expire_in: 1 day
  rules:
    - when: always

allure_job:
  stage: reports
  image: frankescobar/allure-docker-service 
  script:
     - cd "My Project/bin/Debug/net6.0"
     - allure generate -c ./allure-results -o ./allure-report
  artifacts:
    paths:
      - My Project/bin/Debug/net6.0/allure-results
      - My Project/bin/Debug/net6.0/allure-report
    expire_in: 1 day
  rules:
    - when: always

pages:
  stage: deploy
  script:
    - mkdir public
    - mv "My Project/bin/Debug/net6.0/allure-report"/* public
  artifacts:
    paths:
      - public
    expire_in: 1 day
  rules:
    - when: always

c# gitlab continuous-integration nunit allure
© www.soinside.com 2019 - 2024. All rights reserved.