如何为简单的 C 项目正确设置 TravisCI

How to properly setup TravisCI For a simple C project

我正在尝试设置 TravisCI 为我在 C 项目上进行自动构建和测试。

为了学习和理解它,我制作了一个示例 github 回购以使其在将其移至我的最终项目之前起作用。

我的 Project 基本上由 3 个文件组成:

.travis.yml:

language: C

生成文件:

hellomake: main.c
    gcc -o hellomake main.c -I.

main.c:

#include <stdio.h>

void main() 
{
    printf("Hello World!");
}

由于项目现在我在 Travis 中收到以下错误:

0.00s$ ./configure && make && make test
/home/travis/build.sh: line 41: ./configure: No such file or directory
The command "./configure && make && make test" exited with 127.

我错过了什么或做错了什么?

根据The Docs the default script for C projects is ./configure && make && make test. However, as specified just a couple of lines below, "This can be overridden as described in the general build configuration指南。

例如,对于您的项目(只有 Makefile 而没有 test 目标),您可以使用:

script: make

用于构建它(附加到 .travis.yml)。