如何解决如何使用 ros | cmake 与 gitlab-ci
我有一个简单的项目,但我没有使用 GitLab-ci 的经验。我使用 ROS 和 cmake 在我的本地机器(ubuntu18-04)上构建我的项目。 现在我想在 GitLab 上构建我的项目,但这对我来说并不容易。
步骤:
1-) 从 here
安装二进制运行器2-) 从 here 为 Linux 注册的跑步者 - 使用 docker 作为执行器(如 gitlabci;我没有使用 docker 的经验) - 选择 ruby:2.6 默认图像
3-) 现在'我可以在 Settings > CI/CD -> Runners 下看到我的跑步者
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 - runner .. 我刚刚搞混了)
解决方法
我现在正在使用哪个系统
您单击了 selected ruby:2.6 default image
,因此您使用的是 ruby:2.6。然后您可以浏览 docker hub :https://hub.docker.com/_/ruby 和 dockerfile https://github.com/docker-library/ruby/blob/8e49e25b591d4cfa6324b6dada4f16629a1e51ce/2.6/buster/Dockerfile - 我看到它有“buster”,这是 debian 版本之一的名称,所以我猜它是 debian。
如何安装必备软件?
这取决于您使用的映像,不同的 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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。