gitlab에서 iOS 프로젝트의 CI 파이프라인을 설정합니다.일반 도메인 이름 형식
개술
.gitlab-ci.yml CI 파이핑 설정선결 조건
bundler(선택 가능, 코코푸드/fastlane 등 루비에 의존성이 있다면)
brew install jq GitLab CI/CD의 주요 용어
Pipelines는 지속적인 통합, 제공 및 배포를 위한 최상위 수준의 구성 요소입니다.Jobs는 달리기 선수가 실행하는 조작을 정의했다Stages 작업이 언제 실행되는지 정의를 사용하여 CI 파이프를 설정합니다.gitlab ci。yml
stages:
- prebuild
- build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- my-project-path/.bundle
- my-project-path/vendor
install_dependencies:
stage: prebuild
script:
- unset cd
- cd my-project-path
- bundle config set --local deployment 'true'
- bundle install
tags:
- macos_11-2-3
- xcode_12-4
- ios_14-4
build_project:
stage: build
script:
- unset cd
- cd my-project-path
- xcodebuild clean build test -project my-project.xcodeproj -scheme "CI" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- xcrun xccov view --report --json DerivedData/my-project-path/Logs/Test/*.xcresult > xcresult.json
- cat xcresult.json | jq ".lineCoverage" -j | awk '{printf "XCTEST_COVERAGE=%0.2f%%\n",$1*100}'
tags:
- macos_11-2-3
- xcode_12-4
- ios_14-4
구성 파일의 구조:
1-3호선: 두 단계
prebuild와 build를 포함하는 파이프를 정의했다5-9행: 작업 간에 캐시할 경로 정의
11-21행: 정의
install_dependencies 작업23-34행: 정의
build_project 작업28행: Xcode 프로젝트 구축 및 테스트
29-30줄: 코드 커버율 통계 데이터 수집
캐시 작업 간의 의존 관계
my-project-path/.bundle 스토리지 번들 구성 중my-project-path/.vendor 설치된gems${CI_COMMIT_REF_SLUG}는 프로젝트를 생성하는 지점이나 태그 이름캐시가 없으면, 실행
prebuild 단계에서 build 단계에 설치된gems는 같은 기계에서 작업하더라도 삭제됩니다.이 예는 같은 지점에서 캐시를 공유합니다
cd 사용이 설정되지 않았습니다.
rvm를 사용하면 다음과 같이 cd 명령이 재정의됩니다.cd ()
{
__zsh_like_cd cd "$@"
}
cd 명령을 사용하면 ERROR: Build failed with: exit status 1를 던지고 바로 종료unset cd 셸 내장 명령으로 리셋하기cd.cd기타 주의사항
.bash_profile는gitlab의 Runners 부분의 설정과 일치해야 한다.com->project settings->CI/CDtags은git 환매 협의파이프 상태 및 코드 덮어쓰기에 배지 추가
파이프 상태 ID
파이핑 상태를 구성하려면 다음과 같이 하십시오.
.gitlab-ci.ymlPipeline Statushttps://gitlab.com/%{project_path}/-/commits/%{default_branch}
코드 덮어쓰기 배지
https://gitlab.com/%{project_path}/badges/%{default_branch}/pipeline.svg xcrun xccov view --report --json DerivedData/my-project/Logs/Test/*.xcresult > xcresult.json cat xcresult.json | jq ".lineCoverage" -j | awk '{printf "XCTEST_COVERAGE=%0.2f%%\n",$1*100}' 필드lineCoverage가 포함되어야 합니다.%XCTEST_COVERAGE=(\d+.\d+%)Code Coveragehttps://gitlab.com/%{project_path}/-/commits/%{default_branch}도구책
콘셉트
프로비저닝
캐시 작업 간의 의존 관계
배지
문제 해결
Reference
이 문제에 관하여(gitlab에서 iOS 프로젝트의 CI 파이프라인을 설정합니다.일반 도메인 이름 형식), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/ryanzzff/setup-ci-pipeline-for-ios-projects-on-gitlab-com-4nhl텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)