Files
MapLibreParticleLab/circle.yml
2020-03-19 13:41:48 -04:00

545 lines
17 KiB
YAML

version: 2.1
workflows:
version: 2
mbgl-legacy:
jobs:
#
# Naming convention: {platform}-{additional description}-{build type}
# - {platform} is the client platform/framework, which may differ from
# the build platform. Specify both if applicable, e.g., "qt5-macos".
# - {additional description} optionally describes the compiler or other
# unique aspect of the build environment.
# - {build type} is typically "debug" or "release".
#
- ios-debug
- ios-debug-xcode10
- ios-release-template:
name: ios-release
- ios-trigger-metrics:
requires:
- ios-release
filters:
branches:
only: master
- ios-release-tag:
filters:
tags:
only: /ios-.*/
branches:
ignore: /.*/
- macos-debug
nightly:
triggers:
- schedule:
cron: "0 5 * * *"
filters:
branches:
only:
- master
jobs:
- metrics-nightly
- ios-release-template:
name: ios-release-nightly
- ios-sanitize-nightly
- ios-sanitize-address-nightly
- ios-static-analyzer-nightly
- ios-static-analyzer-nightly-xcode10
commands:
npm-install:
steps:
- run:
name: npm install
command: npm install --ignore-scripts
prepare-environment:
steps:
- run:
name: Prepare environment
command: touch "$BASH_ENV" && ./scripts/environment.js | tee -a "$BASH_ENV"
prepare-submodules:
steps:
- run:
name: Prepare submodules
command: git submodule sync && git submodule update --init --recursive
prepare-ccache:
steps:
- run:
name: Prepare ccache
command: |
# CircleCI doesn't have any way to embed arbitrary environment variables or command output
# into cache keys, so we're using the workaround of writing the desired content to a file,
# and then using `{{ checksum "filename" }}` in the cache key.
echo "$CIRCLE_BRANCH"
echo "$CIRCLE_BRANCH" > .circle-branch
echo "$CIRCLE_SHA1"
echo "$CIRCLE_SHA1" > .circle-sha1
echo "$CIRCLE_TARGET_BRANCH"
echo "${CIRCLE_TARGET_BRANCH:master}" > .circle-target-branch
echo "$CIRCLE_MERGE_BASE"
echo "${CIRCLE_MERGE_BASE:master}" > .circle-merge-base
ccache --clear
reset-ccache-stats:
steps:
- run:
name: Clear ccache statistics
command: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats
show-ccache-stats:
steps:
- run:
name: Show ccache statistics
command: ccache --show-stats
save-node_modules-cache:
steps:
- save_cache:
name: Save node_modules cache
key: 'node_modules/v1/{{ arch }}/{{ checksum "package.json" }}'
paths: [ "node_modules" ]
restore-node_modules-cache:
steps:
- restore_cache:
name: Restore node_modules cache
keys:
- 'node_modules/v1/{{ arch }}/{{ checksum "package.json" }}'
- 'node_modules/v1/{{ arch }}'
save-ccache:
steps:
- save_cache:
name: Save ccache
key: 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-branch" }}/{{ checksum ".circle-sha1" }}'
paths: [ "~/.ccache" ]
restore-ccache:
steps:
- restore_cache:
name: Restore ccache
keys:
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-branch" }}/{{ checksum ".circle-sha1" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-branch" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-target-branch" }}/{{ checksum ".circle-merge-base" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}/{{ checksum ".circle-target-branch" }}'
- 'ccache/v1/{{ arch }}/{{ .Environment.CIRCLE_JOB }}'
install-dependencies:
parameters:
node_modules:
type: boolean
default: true
ccache:
type: boolean
default: true
steps:
- checkout
- prepare-submodules
- when:
condition: << parameters.node_modules >>
steps: [ restore-node_modules-cache, npm-install ]
- prepare-environment
- when:
condition: << parameters.ccache >>
steps: [ prepare-ccache, restore-ccache, reset-ccache-stats ]
save-dependencies:
parameters:
node_modules:
type: boolean
default: true
ccache:
type: boolean
default: true
steps:
- when:
condition: << parameters.node_modules >>
steps: [ save-node_modules-cache ]
- when:
condition: << parameters.ccache >>
steps: [ save-ccache, show-ccache-stats ]
configure-cmake:
steps:
- run:
name: CMake configuration step
command: |
mkdir -p build
cd build
cmake -DWITH_COVERAGE=${WITH_COVERAGE:0} -DWITH_OSMESA=${WITH_OSMESA:0} -DWITH_EGL=${WITH_EGL:0} ..
cd ..
build-ios-test:
steps:
- run:
name: Build ios-test
command: make ios-test
no_output_timeout: 20m
build-ios-integration-test:
steps:
- run:
name: Build ios-integration-test
command: make ios-integration-test
build-macos-test:
steps:
- run:
name: Build macos-test
command: make macos-test
no_output_timeout: 20m
check-public-symbols:
steps:
- run:
name: Check public symbols
command: make darwin-check-public-symbols
install-ios-packaging-dependencies:
steps:
- run:
name: Install iOS packaging dependencies
command: |
echo "ruby-2.6" > ~/.ruby-version
./platform/ios/scripts/install-packaging-dependencies.sh
background: true
install-macos-dependencies:
steps:
- run:
name: Install macOS dependencies
command: brew install cmake ccache pkg-config glfw3
trigger-metrics:
steps:
- run:
name: Trigger metrics
command: |
if [ -n "${MOBILE_METRICS_TOKEN}" ]; then
bash -c "curl -X POST --header \"Content-Type: application/json\" --data '{\"parameters\": {\"run_ios_maps_benchmark\": true, \"ci_ref\": $CIRCLE_BUILD_NUM }, \"branch\": \"master\" }' https://circleci.com/api/v2/project/github/mapbox/mobile-metrics/pipeline?circle-token=${MOBILE_METRICS_TOKEN}"
else
echo "MOBILE_METRICS_TOKEN not provided"
fi
collect-xcode-build-logs:
steps:
- run:
name: Collect Xcode build logs
when: always
command: |
export XCODE_LOG_DIR=build/logs
mkdir -p $XCODE_LOG_DIR
cp build/*.log $XCODE_LOG_DIR
upload-xcode-build-logs:
steps:
- store_artifacts:
path: build/logs
notify-slack-nightly-failure:
steps:
- run:
name: Send a Slack notification on nightly failure
when: on_fail
command: |
if [[ $CIRCLE_BRANCH == master ]]; then
export SLACK_MESSAGE="Nightly build of \`$CIRCLE_JOB\` <$CIRCLE_BUILD_URL|failed>."
export SLACK_COLOR="danger"
scripts/notify-slack.sh
fi
#
# Add this step to all regular jobs to enable skipping of certain non-code-related changes.
#
# Do not include this step in nightly or release deployment jobs.
#
# To make a job potentially skippable on changes unrelated to its platform, it must:
# - Target one of the skippable platforms: Android, iOS, or macOS.
# - Have a job name that begins with a supported platform name.
# - Not be related to core functionality or rendering tests. Job names that
# contain "render-tests" cannot be skipped by platform changes.
#
# See the script in the following step for how to implement support for other platforms.
#
check-if-this-job-can-be-skipped:
steps:
- run:
name: Check if this job can be skipped
command: |
if [[ $CIRCLE_BRANCH != master ]] && [[ $CIRCLE_BRANCH != release-* ]] && [[ -z $CIRCLE_TAG ]]; then
scripts/check-ci-job-skippability.js
fi
jobs:
ios-debug:
macos:
xcode: "11.2.1"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- check-public-symbols
- run:
name: Lint podspecs and plist files
command: make ios-lint
- check-if-this-job-can-be-skipped
- build-ios-test
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
# ------------------------------------------------------------------------------
ios-debug-xcode10:
macos:
xcode: "10.3.0"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- check-public-symbols
- run:
name: Lint podspecs and plist files
command: make ios-lint
- check-if-this-job-can-be-skipped
- build-ios-test
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
# ------------------------------------------------------------------------------
ios-sanitize-nightly:
macos:
xcode: "11.2.1"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
SLACK_CHANNEL: CU0LHNNJY
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with thread and undefined behavior sanitizers
command: make ios-sanitize
- run:
name: Get iOS code coverage
command: |
echo "Skipping iOS code coverage"
# Currently failing, need to update for Xcode 11
# platform/ios/scripts/ios-code-coverage.sh CI
#
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-sanitize-address-nightly:
macos:
xcode: "11.2.1"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
SLACK_CHANNEL: CU0LHNNJY
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with address sanitizer
command: make ios-sanitize-address
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-static-analyzer-nightly:
macos:
xcode: "11.2.1"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
SLACK_CHANNEL: CU0LHNNJY
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with the static analyzer
command: make ios-static-analyzer
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-static-analyzer-nightly-xcode10:
macos:
xcode: "10.3.0"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
SLACK_CHANNEL: CU0LHNNJY
steps:
- install-macos-dependencies
- install-dependencies
- run:
name: Build and run SDK unit tests with the static analyzer
command: make ios-static-analyzer
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-release-template:
macos:
xcode: "11.2.1"
shell: /bin/bash --login -eo pipefail
environment:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
SLACK_CHANNEL: CU0LHNNJY
steps:
- install-macos-dependencies
- install-dependencies
- check-if-this-job-can-be-skipped
- install-ios-packaging-dependencies
- run:
name: Build dynamic framework for device and simulator
command: make iframework
no_output_timeout: 20m
- deploy:
name: Upload snapshot build to s3
command: |
if [[ $CIRCLE_BRANCH == master ]]; then
platform/ios/scripts/deploy-snapshot.sh
fi
- deploy:
name: Deploy to Mapbox CocoaPods spec repo
command: |
if [[ $CIRCLE_BRANCH == master ]]; then
platform/ios/scripts/deploy-to-cocoapods.sh
fi
- run:
name: Record size
command: |
echo "Skipping Record size step"
# Skipping due to https://github.com/mapbox/mapbox-gl-native/issues/15751
#platform/ios/scripts/metrics.sh
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- notify-slack-nightly-failure
# ------------------------------------------------------------------------------
ios-release-tag:
macos:
xcode: "11.2.1"
shell: /bin/bash --login -eo pipefail
environment:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
SLACK_CHANNEL: CU0LHNNJY
steps:
- checkout
- run:
name: Send a Slack notification on start
command: |
export SLACK_MESSAGE="<$CIRCLE_BUILD_URL|Release build for \`$CIRCLE_TAG\` started.>"
scripts/notify-slack.sh
- install-macos-dependencies
- install-dependencies
- install-ios-packaging-dependencies
- run:
name: Trigger external deploy steps
command: |
export VERSION_TAG=${CIRCLE_TAG}
export DOCS_REPO="ios-sdk"
scripts/trigger-maps-documentation-deploy-steps.sh
- run:
name: Build, package, and upload iOS release
command: |
export VERSION_TAG=${CIRCLE_TAG}
platform/ios/scripts/deploy-packages.sh
no_output_timeout: 20m
- deploy:
name: Deploy to CocoaPods
command: platform/ios/scripts/deploy-to-cocoapods.sh
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
- run:
name: Send a Slack notification on failure
when: on_fail
command: |
export SLACK_MESSAGE="<$CIRCLE_BUILD_URL|Release build for \`$CIRCLE_TAG\` failed.>"
export SLACK_COLOR="danger"
scripts/notify-slack.sh
- run:
name: Send a Slack notification on success
when: on_success
command: |
export SLACK_MESSAGE="<$CIRCLE_BUILD_URL|Release build for \`$CIRCLE_TAG\` succeeded.>"
export SLACK_COLOR="good"
scripts/notify-slack.sh
# ------------------------------------------------------------------------------
ios-trigger-metrics:
macos:
xcode: "11.2.1"
steps:
- trigger-metrics
# ------------------------------------------------------------------------------
macos-debug:
macos:
xcode: "11.2.1"
environment:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- install-macos-dependencies
- install-dependencies
- check-if-this-job-can-be-skipped
- build-macos-test
- check-public-symbols
- run:
name: Lint plist files
command: make macos-lint
- run:
name: Nitpick Darwin code generation
command: scripts/nitpick/generated-code.js darwin
- save-dependencies
- store_artifacts:
path: test/fixtures
destination: test/fixtures
- collect-xcode-build-logs
- upload-xcode-build-logs
# ------------------------------------------------------------------------------
metrics-nightly:
docker:
- image: mbgl/linux-gcc-5:54f59e3ac5
working_directory: /src
environment:
LIBSYSCONFCPUS: 2
JOBS: 2
steps:
- install-dependencies
- run:
name: Collect GitHub statistics
command: |
scripts/publish_github_stats.js