---
title: GitLab流水线示例代码
description: "示例代码如下："
url: https://www.hikunpeng.com/document/detail/zh/nativedevp/userguide/pipeline/NativeDevelopment_0117.html
sourcePath: /source/zh/nativedevp/userguide/pipeline/NativeDevelopment_0117.html
indexId: f0f9d1b1cb55a327d90275547cc3fbd1ca7e8607029bd9ed8592c59f213da26f68
---
# GitLab流水线示例代码

#### 不使用A-FOT

示例代码如下：
```
stages:          # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job:       # This job runs in the build stage, which runs first.
stage: build
script:
# 安装完成后已有GCC for openEuler的环境，编译命令与其他平台保持一致。
- cd
/home/test
# 执行原有的构建脚本
- sh build.sh
tags:
- kunpeng_c_builder_gcc # 对应gitlab-runner注册时的标签，可选择多个
```


“/home/test”指项目文件路径，请根据实际情况进行替换。


#### 使用A-FOT（配置文件参数优化）

示例代码如下：
```
stages:          # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job:       # This job runs in the build stage, which runs first.
stage: build
script:
# A-FOT 会直接调用原有的构建脚本
a-fot --config_file a-fot.ini'
tags:
- kunpeng_c_builder_gcc # 对应gitlab-runner注册时的标签，可选择多个
```


#### 使用A-FOT（命令行参数优化）

示例代码如下：

```
stages:          # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job:       # This job runs in the build stage, which runs first.
stage: build
script:
a-fot --opt_mode AutoFDO --gcc_path
/usr
--run_script
/root/run.sh
--build_script
/root/build.sh
--build_mode Wrapper --work_path
./
--bin_file
/tmp/test
'
tags:
- kunpeng_c_builder_gcc # 对应gitlab-runner注册时的标签，可选择多个
```

优化模式为AutoFDO，GCC路径为/usr，应用运行脚本路径为/root/run.sh，应用构建脚本路径为/root/build.sh，构建模式为Wrapper，脚本工作目录为当前目录，可执行二进制文件路径为/tmp/test，请根据实际情况进行替换。
