-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'v3.3.0-rc.1' into release/v3.x
- Loading branch information
Showing
169 changed files
with
2,368 additions
and
17,596 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline process engine. | ||
# See: https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# Explicit tag filters to trigger workflows on tags | ||
tag_filters: &tag_filters | ||
filters: | ||
tags: | ||
only: | ||
- /.+/ | ||
|
||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||
jobs: | ||
combine-binaries: | ||
docker: | ||
- image: alpine:latest | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASSWORD | ||
resource_class: small | ||
steps: | ||
- run: | ||
name: "Prepare" | ||
command: | | ||
apk add --no-cache bash zip unzip | ||
- attach_workspace: | ||
at: ~/workspace | ||
- run: | ||
name: "Combine binaries" | ||
shell: /bin/bash | ||
command: | | ||
for f in $(find $HOME/workspace/release -name '*has_failures'); do | ||
cat $f >> $HOME/has_failures | ||
done | ||
failures=$(cat $HOME/has_failures) | ||
if [ "${failures}" != "" ]; then | ||
exit 0 | ||
fi | ||
COMBINE_BINARIES=$(head -n 1 <(find $HOME/workspace/release/ -name 'combine_binaries.sh')) | ||
RELEASE_REF=$(head -n 1 <(cat $HOME/workspace/release/*/ref)) | ||
$COMBINE_BINARIES $HOME/workspace/release $RELEASE_REF $HOME | ||
RESULT=$? | ||
if [ $RESULT -ne 0 ]; then | ||
exit 0 | ||
fi | ||
echo "${CIRCLE_BUILD_NUM}" > $HOME/workspace/release/binaries_build_num | ||
exit 0 | ||
- persist_to_workspace: | ||
root: ~/workspace | ||
paths: | ||
- release | ||
- store_artifacts: | ||
path: ~/release | ||
report: | ||
docker: | ||
- image: alpine:latest | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASSWORD | ||
resource_class: small | ||
working_directory: ~/device-os | ||
steps: | ||
- attach_workspace: | ||
at: ~/workspace | ||
- run: | ||
name: "Make a report" | ||
command: | | ||
apk add --no-cache bash curl | ||
export CIRCLE_BUILD_TIMESTAMP=$(head -n 1 <(cat $HOME/workspace/release/timestamp_* | sort -n)) | ||
mkdir $HOME/failures | ||
for f in $(find $HOME/workspace/release -name '*has_failures'); do | ||
cat $f >> $HOME/failures/has_failures | ||
done | ||
if [ -f $HOME/workspace/release/binaries_build_num ]; then | ||
export CIRCLE_ARTIFACTS_URL="https://app.circleci.com/jobs/github/particle-iot/device-os/$(cat $HOME/workspace/release/binaries_build_num)/artifacts" | ||
fi | ||
export CIRCLE_WORKFLOW_URL="https://app.circleci.com/pipelines/workflows/${CIRCLE_WORKFLOW_ID}" | ||
GENERATE_MESSAGE=$(head -n 1 <(find $HOME/workspace/release/ -name 'cf_generate_message.sh')) | ||
bash ${GENERATE_MESSAGE} $HOME/failures | ||
export SLACK_MESSAGE=$(bash ${GENERATE_MESSAGE} $HOME/failures) | ||
curl -X POST -H "Content-type: application/json" --data "${SLACK_MESSAGE}" ${SLACK_WEBHOOK_URL} | ||
for f in $(find $HOME/workspace/release -name '*has_failures'); do | ||
failure=$(cat $f) | ||
if [ "${failure}" != "" ]; then | ||
cat "$(dirname $f)/log" | ||
fi | ||
done | ||
echo "${SLACK_MESSAGE}" | grep 'failed in' && exit 1 || exit 0 | ||
build-and-test: | ||
docker: | ||
- image: docker:stable-git | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASSWORD | ||
working_directory: ~/device-os | ||
resource_class: small | ||
parameters: | ||
platform: | ||
type: string | ||
steps: | ||
- checkout | ||
# https://support.circleci.com/hc/en-us/articles/360050934711 | ||
- setup_remote_docker: | ||
version: 19.03.13 | ||
- run: | ||
name: "Install bash" | ||
command: | | ||
TIMESTAMP_FILE=timestamp_$RANDOM | ||
mkdir -p $HOME/workspace/release | ||
date +%s > $HOME/workspace/release/$TIMESTAMP_FILE | ||
apk -q update && apk -q add bash | ||
- run: | ||
name: "Fetch dependencies" | ||
shell: /bin/bash | ||
command: | | ||
cd $HOME | ||
source $HOME/device-os/.buildpackrc | ||
git clone [email protected]:particle-iot/firmware-buildpack-builder.git -b "$BUILDPACK_BUILDER_VERSION" | ||
cd $HOME/device-os | ||
git submodule update --init --recursive | ||
if [ -z "$CIRCLE_TAG" ]; then | ||
export ARTIFACT_TAG=$(echo "$CIRCLE_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's,/,-,g')-$(git rev-parse --short HEAD) | ||
else | ||
export ARTIFACT_TAG=$CIRCLE_TAG | ||
fi | ||
echo "$ARTIFACT_TAG" > $HOME/device-os/.git/ref | ||
- run: | ||
name: "Run tests / build for platforms" | ||
shell: /bin/bash | ||
command: | | ||
cd $HOME/device-os | ||
export FIRMWARE_PATH=$HOME/device-os | ||
export TAG=$(cat $HOME/device-os/.git/ref) | ||
export DOCKER_IMAGE_NAME=particle/cf-device-os-buildpack | ||
mkdir -p ~/failures | ||
export BUILD_PLATFORM="<< parameters.platform >>" | ||
export BUILDPACK_NORM=1 | ||
export BUILD_PLATFORM_NORMALIZED=$(echo "$BUILD_PLATFORM" | sed 's/ /_/g') | ||
export EXTRA_ARG="--env DEVICE_OS_CI_API_TOKEN=$DEVICE_OS_CI_API_TOKEN --env CI_BUILD_RELEASE=1 --name build --env VERSION=$TAG" | ||
mkdir -p $HOME/workspace/release/$BUILD_PLATFORM_NORMALIZED | ||
$HOME/firmware-buildpack-builder/scripts/ci | tee $HOME/workspace/release/$BUILD_PLATFORM_NORMALIZED/log | tee >(grep -E '^has_failures [0-9]+ ' > $HOME/failures/has_failures); export TMPRESULT=${PIPESTATUS[0]} | ||
cp -r $HOME/failures/* $HOME/workspace/release/$BUILD_PLATFORM_NORMALIZED/ || true | ||
export RESULT=${TMPRESULT} | ||
echo ${RESULT} | ||
# exit ${RESULT} | ||
exit 0 | ||
- run: | ||
shell: /bin/bash | ||
name: Copy artifacts | ||
command: | | ||
export BUILD_PLATFORM="<< parameters.platform >>" | ||
export BUILD_PLATFORM=$(echo "$BUILD_PLATFORM" | sed 's/ /_/g') | ||
mkdir -p $HOME/workspace/release/$BUILD_PLATFORM | ||
export TAG=$(cat $HOME/device-os/.git/ref) | ||
docker cp build:/firmware/compiled-binaries/$TAG $HOME/workspace/release/$BUILD_PLATFORM/ || true | ||
cp $HOME/device-os/build/release-publish.sh $HOME/workspace/release/$BUILD_PLATFORM/ | ||
cp $HOME/device-os/ci/combine_binaries.sh $HOME/workspace/release/$BUILD_PLATFORM/ | ||
cp $HOME/device-os/ci/cf_generate_message.sh $HOME/workspace/release/$BUILD_PLATFORM/ | ||
docker cp build:/firmware/build/coverage $HOME/workspace/release/ | ||
cp $HOME/device-os/.git/ref $HOME/workspace/release/$BUILD_PLATFORM/ref | ||
find $HOME/workspace/release | ||
exit 0 | ||
- persist_to_workspace: | ||
root: ~/workspace | ||
paths: | ||
- release | ||
|
||
|
||
workflows: | ||
build-and-test: | ||
jobs: | ||
- build-and-test: | ||
<<: *tag_filters | ||
context: | ||
- particle-ci-private | ||
matrix: | ||
parameters: | ||
platform: ["photon", "p1", "electron", "argon", "boron", "bsom", "b5som", "tracker", "unit-test newhal gcc"] | ||
- combine-binaries: | ||
requires: | ||
- build-and-test | ||
- report: | ||
requires: | ||
- build-and-test | ||
- combine-binaries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.