如何在 Gitlab 上使用 Angular 为 ASP.NET Core Web 应用程序设置构建和测试管道?

Aka*_*ate 0 gitlab-ci asp.net-core angular

我正在尝试使用 docker 镜像 mcr.microsoft.com/dotnet/core/sdk:2.2 使用 Angular 为 ASP.NET Core Web 应用程序编写 .gitlab-ci.yml 文件

构建失败并出现错误,指出缺少 Nodejs。该项目需要节点下载依赖项并构建嵌入其中的 Angular 应用程序。

.gitlab-ci.yml

image: mcr.microsoft.com/dotnet/core/sdk:2.2

stages:
    - build
    - test

variables:
    test: "testcases"

before_script:
    - "cd src"
    - "dotnet restore"
build:
    stage: build
    script:
        - "dotnet build"

test:
    stage: test
    script: 
        - "cd $test"
        - "dotnet test"
Run Code Online (Sandbox Code Playgroud)

Aka*_*ate 5

成功了!在执行构建之前刚刚安装了节点和角度 CLI。

.gitlab-ci.yml

image: mcr.microsoft.com/dotnet/core/sdk:2.2

stages:
    - build
    - test

variables:
    test: "testcases"

before_script:
    - "dotnet --info"
    - "curl -sL https://deb.nodesource.com/setup_10.x | bash -"
    - "apt-get install -y nodejs"
    - "npm install -g @angular/cli"
build:
    stage: build
    script:
        - "cd src"
        - "dotnet build"

test:
    stage: test
    script: 
        - "cd $test"
        - "dotnet test"

Run Code Online (Sandbox Code Playgroud)