如何使用ros | cmake 与 gitlab-ci
how to use ros | cmake with gitlab-ci
我有一个简单的项目,但我没有使用 GitLab-ci 的经验。我使用 ROS 和 cmake 在我的本地机器上构建我的项目 (ubuntu18-04)。
现在我想在 GitLab 上构建我的项目,但这对我来说并不容易。
步骤:
1-) 安装了来自 here
的二进制 运行ners
2-) 注册了来自 here 的 运行 人 Linux
- 使用 docker 作为执行者(比如 gitlabci;我没有使用 docker 的经验)
- 选择 ruby:2.6 默认图像
3-) 现在,我可以在设置 > CI/CD -> 跑步者
下看到我的 运行ner
4-) 创建 gitlab 提供的示例 .yml
build-job:
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
test-job1:
stage: test
script:
- echo "This job tests something"
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
deploy-prod:
stage: deploy
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
它正在运行!
但现在我想在 gitlab-ci 上构建我的代码。文件结构:
scripts
->build.sh
src
->Cmakelist.txt
->codes.cpp
binaries
->outputs ll be here.
.gitlab-ci.yml
build.sh 做我想做的一切:
...
mkdir build
cd build
cmake .. -GNinja
ninja
所以我只需要 运行 它。但我不知道如何安装先决条件。
我现在正在使用哪个系统以及如何安装先决条件? (ubuntu 18.04 - docker - 运行ner.. 我只是搞混了)
Which system exactly am I working on right now
您点击了 selected ruby:2.6 default image
,所以您在 ruby:2.6。然后您可以浏览 docker 集线器:https://hub.docker.com/_/ruby and dockerfile https://github.com/docker-library/ruby/blob/8e49e25b591d4cfa6324b6dada4f16629a1e51ce/2.6/buster/Dockerfile - 我看到它有“buster”,这是 debian 发行版之一的名称,所以我猜它是 debian。
how can I install prerequisites?
这取决于您使用的图像,不同的 linux 发行版使用不同的包管理器。我一般会看看wiki package manager.
你可以像这样:
build:
image: ubuntu
script:
- apt-get install -y cmake gcc whatever-else-like-you-have-on-your-machine
- ./scripts/build.sh
我有一个简单的项目,但我没有使用 GitLab-ci 的经验。我使用 ROS 和 cmake 在我的本地机器上构建我的项目 (ubuntu18-04)。 现在我想在 GitLab 上构建我的项目,但这对我来说并不容易。
步骤:
1-) 安装了来自 here
的二进制 运行ners2-) 注册了来自 here 的 运行 人 Linux - 使用 docker 作为执行者(比如 gitlabci;我没有使用 docker 的经验) - 选择 ruby:2.6 默认图像
3-) 现在,我可以在设置 > CI/CD -> 跑步者
下看到我的 运行ner4-) 创建 gitlab 提供的示例 .yml
build-job:
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
test-job1:
stage: test
script:
- echo "This job tests something"
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
deploy-prod:
stage: deploy
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
它正在运行!
但现在我想在 gitlab-ci 上构建我的代码。文件结构:
scripts
->build.sh
src
->Cmakelist.txt
->codes.cpp
binaries
->outputs ll be here.
.gitlab-ci.yml
build.sh 做我想做的一切:
...
mkdir build
cd build
cmake .. -GNinja
ninja
所以我只需要 运行 它。但我不知道如何安装先决条件。 我现在正在使用哪个系统以及如何安装先决条件? (ubuntu 18.04 - docker - 运行ner.. 我只是搞混了)
Which system exactly am I working on right now
您点击了 selected ruby:2.6 default image
,所以您在 ruby:2.6。然后您可以浏览 docker 集线器:https://hub.docker.com/_/ruby and dockerfile https://github.com/docker-library/ruby/blob/8e49e25b591d4cfa6324b6dada4f16629a1e51ce/2.6/buster/Dockerfile - 我看到它有“buster”,这是 debian 发行版之一的名称,所以我猜它是 debian。
how can I install prerequisites?
这取决于您使用的图像,不同的 linux 发行版使用不同的包管理器。我一般会看看wiki package manager.
你可以像这样:
build:
image: ubuntu
script:
- apt-get install -y cmake gcc whatever-else-like-you-have-on-your-machine
- ./scripts/build.sh