我如何使用 Gitlab CI .yml 文件打印 Hello World

How do i print Hello World using Gitlab CI .yml file

我正在尝试使用来自 gitlab ci 的消息 C 语言打印 Hello World。但是我没有收到我的管道构建成功的消息。下面是 .yml 代码:

image: gcc

build: 
    stage: build


    script: 
        - gcc src/c-test.c -o mybinary
    artifacts:
        paths:
            - mybinary
    cache:
        paths: 
            - "*.o"

管道构建完美,但我没有看到我在 printf 中编写的消息。我只看到作业成功的消息。

您需要执行生成的二进制文件。
- ./mybinary 添加到 script: 部分,如下所示:

image: gcc

build: 
    stage: build


    script: 
        - gcc src/c-test.c -o mybinary
        - ./mybinary # here
    artifacts:
        paths:
            - mybinary
    cache:
        paths: 
            - "*.o"