加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.gitlab-ci.yml 3.68 KB
一键复制 编辑 原始数据 按行查看 历史
hongxintml 提交于 2024-08-06 19:05 . build scripts update
stages:
- build_bin
- build_rpm
- build_deb
- build_njet_image
- push_njet_image
build_bin:
stage: build_bin
image: tmlake/njet-build:centos7
# variables:
# DOCKER_AUTH_CONFIG: '{"auths": {"192.168.30.226": {"auth": "emhhb3lnZjpaaGFveWdmMTIzNDU="}}}'
# image: gcc:4.8.5 # gcc 版本
script:
- sudo chmod +x ./build_cc.sh ./configure
- sudo ./build_cc.sh -t $CI_COMMIT_SHA -d conf
- sudo make -j `nproc`
- sudo ./build_cc.sh install
- sudo chmod +x ./build_lua.sh
- sudo mkdir -p objs/scripts/register/
- sudo ./build_lua.sh
- sudo mkdir -p work/usr/local # 创建文件包目录
- sudo cp -a /usr/local/njet work/usr/local/
artifacts:
paths: # 需要打包的文件
- objs/njet
- objs/*.so
- objs/scripts
- work/*
expire_in: 1 week # 打包文件存储有效期
build_rpm:
stage: build_rpm
#image: tmlake/rpmbuild:1.1
image: tmlake/njet-build:centos7
# variables:
# DOCKER_AUTH_CONFIG: '{"auths": {"192.168.30.226": {"auth": "emhhb3lnZjpaaGFveWdmMTIzNDU="}}}'
when: manual
script:
- cd ..
- tar cf /home/builder/rpm/njet_main.tar --exclude="njet_main/.git" njet_main
- sudo chmod +x njet_main/build/rpm/generate_njet_spec.sh
- cd njet_main
- cd build/rpm && NJT_BUILD_OPT="-t $CI_COMMIT_SHA" ./generate_njet_spec.sh && cd -
- cp build/rpm/njet.spec /home/builder/rpm/
- rpmbuild -bb /home/builder/rpm/njet.spec
- sudo mkdir -p work
- sudo cp -a /home/builder/rpm/x86_64/*.rpm work/
artifacts:
paths: # 需要打包的文件
- work/*.rpm
expire_in: 1 week # 打包文件存储有效期
build_deb:
stage: build_deb
image: tmlake/njet-build:ubuntu18.04
when: manual
script:
- ./build_cc.sh -t $CI_COMMIT_SHA conf
- make -j `nproc`
- ./build_cc.sh install
- chmod +x ./build_lua.sh
- mkdir -p objs/scripts/register/
- ./build_lua.sh
- mkdir -p build/deb/usr/local
- cp -a /usr/local/njet build/deb/usr/local
- rm -f build/deb/usr/local/njet/lib/*.a
- cp -a objs/scripts/so/* build/deb/usr/local/njet/lualib/clib/
- rm -rf objs/scripts/so
- cp -a objs/scripts/* build/deb/usr/local/njet/modules/
- cp -a build/api_gateway.db build/deb/usr/local/njet/data
- cd build && ./generate_deb.sh && cd -
- mkdir -p work
- cp -a build/*.deb work/
artifacts:
paths: # 需要打包的文件
- work/*.deb
expire_in: 1 week # 打包文件存储有效期
variables:
NJET_RIEPOSITORY: "tmlake/njet"
DOCKER_TLS_CERTDIR: ""
build_njet_image:
stage: build_njet_image
image: docker:20.10.11
services:
- docker:20.10.11-dind
before_script:
- docker info
script:
- export
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
- apk update
- apk add make git
- echo "njet build start..."
- id
- mkdir docker-images
- DOCKER_BUILDKIT=1 docker build --build-arg BUILD_OS=ubuntu-njet --build-arg NJet_VERSION=$NJET_TAG --build-arg GIT_COMMIT=$CI_COMMIT_SHA --network host --target ubuntu-njet -f ./build/docker/Dockerfile_njet -t $NJET_RIEPOSITORY:$NJET_TAG ./
- docker images
- docker save $NJET_RIEPOSITORY:$NJET_TAG > docker-images/njet-$NJET_TAG.tar
- ls docker-images
- echo "njet build end..."
artifacts:
paths:
- docker-images/
when: manual
push_njet_image:
stage: push_njet_image
image: docker:20.10.11
services:
- docker:20.10.11-dind
before_script:
- docker info
script:
- docker images
- ls docker-images
- docker load -i docker-images/njet-$NJET_TAG.tar
- docker images
- docker push $NJET_RIEPOSITORY:$NJET_TAG
dependencies:
- build_njet_image
when: manual
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化