Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

7 changes: 0 additions & 7 deletions .github/pull_request_template.md

This file was deleted.

98 changes: 0 additions & 98 deletions .github/workflows/build.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/test.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/update-notice-year.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
inputSet:
name: flutter-sdk-plugin-inputset
identifier: fluttersdkplugininputset
orgIdentifier: PROD
projectIdentifier: Harness_Split
pipeline:
identifier: fluttersdkplugin
properties:
ci:
codebase:
build:
type: branch
spec:
branch: <+trigger.sourceBranch>
170 changes: 170 additions & 0 deletions .harness/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
pipeline:
name: flutter-sdk-plugin-repo
identifier: fluttersdkplugin
projectIdentifier: Harness_Split
orgIdentifier: PROD
tags: {}
properties:
ci:
codebase:
connectorRef: fmegithubharnessgitops
repoName: flutter-sdk-plugin
build:
type: branch
spec:
branch: <+input>
stages:
- stage:
name: Build and Test
identifier: Build_and_Test
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: true
override: true
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec:
size: flex
execution:
steps:
- step:
type: Run
name: Install Java
identifier: Install_Java
spec:
shell: Sh
command: |-
apt-get install -y openjdk-17-jdk -qq
java -version
- step:
type: Run
name: Install Flutter
identifier: Install_Flutter
spec:
shell: Bash
command: |-
git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter
export PATH="$HOME/flutter/bin:$PATH"
flutter --version
flutter config --no-analytics
flutter precache
- step:
type: Run
name: Test splitio
identifier: Test_splitio
spec:
shell: Bash
command: |-
export PATH="$HOME/flutter/bin:$PATH"
cd splitio
flutter pub get
flutter test
- step:
type: Run
name: Test splitio_android
identifier: Test_splitio_android
spec:
shell: Bash
command: |-
export PATH="$HOME/flutter/bin:$PATH"
cd splitio_android
flutter pub get
flutter test
- step:
type: Run
name: Test splitio_ios
identifier: Test_splitio_ios
spec:
shell: Bash
command: |-
export PATH="$HOME/flutter/bin:$PATH"
cd splitio_ios
flutter pub get
flutter test
- step:
type: Run
name: Test splitio_web
identifier: Test_splitio_web
spec:
shell: Bash
command: |-
export PATH="$HOME/flutter/bin:$PATH"
cd splitio_web
flutter pub get
flutter test --platform=chrome
- step:
type: Run
name: SonarQube Scan
identifier: SonarQube_Scan
when:
stageStatus: Success
condition: <+matrix.sdkVersion> == "stable"
spec:
shell: Sh
command: |-
export SONAR_SCANNER_VERSION=5.0.1.3006
curl -sSLo sonar-scanner.zip \
"https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip"
unzip -q sonar-scanner.zip
export PATH="$PWD/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin:$PATH"
apt-get install -y openjdk-17-jdk -qq
sonar-scanner \
-Dsonar.projectKey=flutter-sdk-plugin \
-Dsonar.sources=splitio/lib,splitio_android/lib,splitio_ios/lib,splitio_web/lib,splitio_platform_interface/lib \
-Dsonar.tests=splitio/test,splitio_android/test,splitio_ios/test,splitio_web/test,splitio_platform_interface/test \
-Dsonar.host.url=https://sonar.harness.io \
-Dsonar.token=<+secrets.getValue("sonarqube-token")> \
-Dsonar.exclusions="**/example/**,**/.dart_tool/**,**/build/**"
- step:
type: Run
name: Post Quality Gate
identifier: Post_Quality_Gate
when:
stageStatus: Success
condition: <+matrix.sdkVersion> == "stable"
spec:
shell: Bash
command: |-
#!/bin/bash
set -e

SONAR_TOKEN="<+secrets.getValue("sonarqube-token")>"
SONAR_URL="https://sonar.harness.io"
SONAR_PROJECT_KEY="flutter-sdk-plugin"
GITHUB_TOKEN="<+secrets.getValue("github-devops-token")>"
GITHUB_REPO="flutter-sdk-plugin"
COMMIT_SHA="<+codebase.commitSha>"

STATUS_JSON=$(curl -sf \
-H "Authorization: Bearer ${SONAR_TOKEN}" \
"${SONAR_URL}/api/qualitygates/project_status?projectKey=${SONAR_PROJECT_KEY}")

QG_STATUS=$(echo "$STATUS_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['projectStatus']['status'])")

case "$QG_STATUS" in
OK) GH_STATE="success"; DESCRIPTION="Quality gate passed" ;;
ERROR) GH_STATE="failure"; DESCRIPTION="Quality gate failed" ;;
WARN) GH_STATE="success"; DESCRIPTION="Quality gate passed with warnings" ;;
*) GH_STATE="pending"; DESCRIPTION="Quality gate status unknown" ;;
esac

TARGET_URL="${SONAR_URL}/dashboard?id=${SONAR_PROJECT_KEY}"

curl -sf -X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" \
-d "{\"state\":\"${GH_STATE}\",\"description\":\"${DESCRIPTION}\",\"context\":\"sonarqube/quality-gate\",\"target_url\":\"${TARGET_URL}\"}" \
"https://api.github.com/repos/splitio/${GITHUB_REPO}/statuses/${COMMIT_SHA}"

echo "Posted SonarQube quality gate status: ${GH_STATE}"
strategy:
matrix:
sdkVersion:
- "stable"