mirror of https://github.com/dapr/community.git
Configuring workflow, needs testing.
Signed-off-by: Artur Souza <artursouza.ms@outlook.com>
This commit is contained in:
parent
00fbebc2e3
commit
a42af6351e
|
@ -0,0 +1,21 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: dapr-github-metrics-binding
|
||||
spec:
|
||||
type: bindings.azure.blobstorage
|
||||
version: v1
|
||||
metadata:
|
||||
- name: storageAccount
|
||||
secretKeyRef:
|
||||
name: GITHUB_METRICS_STORAGE_ACCOUNT
|
||||
key: GITHUB_METRICS_STORAGE_ACCOUNT
|
||||
- name: storageAccessKey
|
||||
secretKeyRef:
|
||||
name: GITHUB_METRICS_STORAGE_ACCESS_KEY
|
||||
key: GITHUB_METRICS_STORAGE_ACCESS_KEY
|
||||
- name: container
|
||||
value: metrics
|
||||
|
||||
auth:
|
||||
secretStore: env-secret-store
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: env-secret-store
|
||||
spec:
|
||||
type: secretstores.local.env
|
||||
version: v1
|
||||
metadata:
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2021 The Dapr Authors
|
||||
# Copyright 2022 The Dapr Authors
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -24,6 +24,7 @@ from dapr.clients import DaprClient
|
|||
from github import Github
|
||||
|
||||
ONE_DAY = timedelta(days=1)
|
||||
FIVE_DAYS = timedelta(days=5)
|
||||
|
||||
githubToken = os.getenv("GITHUB_TOKEN")
|
||||
|
||||
|
@ -67,6 +68,7 @@ issues_since=datetime.now()-timedelta(days=30)
|
|||
|
||||
total_count = 0
|
||||
triaged_count = 0
|
||||
triaged_under_5_days_count = 0
|
||||
expected_total_time_to_triage = timedelta()
|
||||
total_time_to_triage = timedelta()
|
||||
|
||||
|
@ -90,6 +92,8 @@ for repo in my_repos:
|
|||
if is_triaged(first_label_events):
|
||||
total_time_to_triage += time_to_triage
|
||||
triaged_count += 1
|
||||
if time_to_triage.total_seconds() <= FIVE_DAYS.total_seconds():
|
||||
triaged_under_5_days_count += 1
|
||||
print('Issue %s created %s ago and triaged in %s' % (issue.html_url, humanize.naturaldelta(
|
||||
now - issue.created_at), humanize.naturaldelta(time_to_triage)))
|
||||
else:
|
||||
|
@ -98,22 +102,25 @@ for repo in my_repos:
|
|||
|
||||
average_days_to_triage = (total_time_to_triage / triaged_count).total_seconds() / ONE_DAY.total_seconds()
|
||||
expected_average_days_to_triage = (expected_total_time_to_triage / total_count).total_seconds() / ONE_DAY.total_seconds()
|
||||
triaged_under_5_days_ratio = triaged_under_5_days_count / total_count
|
||||
|
||||
output = json.dumps({
|
||||
'date': now.strftime('%Y-%m-%d'),
|
||||
'last_30days_total_issues': total_count,
|
||||
'last_30days_total_issues_triaged': triaged_count,
|
||||
'last_30days_total_issues_triaged_in_5_days': triaged_under_5_days_count,
|
||||
'last_30days_total_issues_triaged_in_5_days_percentage': triaged_under_5_days_ratio * 100.0,
|
||||
'last_30days_average_days_to_triage': average_days_to_triage,
|
||||
'last_30days_expected_average_days_to_triage': expected_average_days_to_triage,
|
||||
})
|
||||
|
||||
print("%d issues, %lf %% triaged, %.2lf days on average" % (total_count,
|
||||
(triaged_count * 100.0) / total_count, expected_average_days_to_triage))
|
||||
print("%d issues, %lf %% triaged, %.2lf days on average, %lf %% triaged under 5 days" % (total_count,
|
||||
(triaged_count * 100.0) / total_count, expected_average_days_to_triage, triaged_under_5_days_ratio * 100.0))
|
||||
|
||||
print(output)
|
||||
with DaprClient() as d:
|
||||
d.wait(60)
|
||||
filename = now.strftime('%Y/%m/%d') + '/last_30days_triage_metrics.json'
|
||||
filename = now.strftime('%Y/%m/%d') + '/last_30days_bugs_triage_metrics.json'
|
||||
resp = d.invoke_binding(
|
||||
binding_name='dapr-github-metrics-binding',
|
||||
operation='create',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2021 The Dapr Authors
|
||||
# Copyright 2022 The Dapr Authors
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -9,45 +9,22 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: Auto Validate Examples
|
||||
name: Calculate GitHub Metrics for Dapr's repositories
|
||||
|
||||
on:
|
||||
# Run every day
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
# Manual trigger
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ 11, 13, 15, 16 ]
|
||||
env:
|
||||
GOVER: 1.17.7
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
GOPROXY: https://proxy.golang.org
|
||||
JDK_VER: ${{ matrix.java }}
|
||||
DAPR_CLI_VER: 1.7.0-rc.2
|
||||
DAPR_RUNTIME_VER: 1.7.0-rc.2
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.7.0-rc.2/install/install.sh
|
||||
DAPR_CLI_REF:
|
||||
DAPR_REF: 4cf499448ef6ee87c83db6a11b84e83237e92665
|
||||
DAPR_CLI_VER: 1.7.0
|
||||
DAPR_RUNTIME_VER: 1.7.2
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.7.0/install/install.sh
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up OpenJDK ${{ env.JDK_VER }}
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: ${{ env.JDK_VER }}
|
||||
- name: Set up Dapr CLI
|
||||
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
|
||||
- name: Set up Go ${{ env.GOVER }}
|
||||
|
@ -55,110 +32,17 @@ jobs:
|
|||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GOVER }}
|
||||
- name: Checkout Dapr CLI repo to override dapr command.
|
||||
uses: actions/checkout@v3
|
||||
if: env.DAPR_CLI_REF != ''
|
||||
with:
|
||||
repository: dapr/cli
|
||||
ref: ${{ env.DAPR_CLI_REF }}
|
||||
path: cli
|
||||
- name: Checkout Dapr repo to override daprd.
|
||||
uses: actions/checkout@v3
|
||||
if: env.DAPR_REF != ''
|
||||
with:
|
||||
repository: dapr/dapr
|
||||
ref: ${{ env.DAPR_REF }}
|
||||
path: dapr
|
||||
- name: Build and override dapr cli with referenced commit.
|
||||
if: env.DAPR_CLI_REF != ''
|
||||
run: |
|
||||
cd cli
|
||||
make
|
||||
sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr
|
||||
cd ..
|
||||
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
|
||||
run: |
|
||||
dapr uninstall --all
|
||||
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
|
||||
- name: Build and override daprd with referenced commit.
|
||||
if: env.DAPR_REF != ''
|
||||
run: |
|
||||
cd dapr
|
||||
make
|
||||
mkdir -p $HOME/.dapr/bin/
|
||||
cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd
|
||||
cd ..
|
||||
- name: Override placement service.
|
||||
if: env.DAPR_REF != ''
|
||||
run: |
|
||||
docker stop dapr_placement
|
||||
cd dapr
|
||||
./dist/linux_amd64/release/placement &
|
||||
- name: Install utilities dependencies
|
||||
run: |
|
||||
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
|
||||
pip3 install setuptools wheel
|
||||
pip3 install mechanical-markdown
|
||||
- name: Install Vault CLI
|
||||
pip3 install dapr PyGitHub
|
||||
working-directory: ./.github/scripts
|
||||
env:
|
||||
GITHUB_METRICS_STORAGE_ACCOUNT: ${{ secrets.GITHUB_METRICS_STORAGE_ACCOUNT }}
|
||||
GITHUB_METRICS_STORAGE_ACCESS_KEY: ${{ secrets.GITHUB_METRICS_STORAGE_ACCESS_KEY }}
|
||||
run: |
|
||||
# From the installtion page of vault https://learn.hashicorp.com/tutorials/vault/getting-started-install?in=vault/getting-started
|
||||
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
|
||||
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
|
||||
sudo apt-get update
|
||||
sudo apt-get install vault
|
||||
# Verify vault is installed
|
||||
vault -h
|
||||
- name: Install Local mongo database using docker-compose
|
||||
run: |
|
||||
docker-compose -f ./sdk-tests/deploy/local-test-mongo.yml up -d
|
||||
docker ps
|
||||
- name: Clean up files
|
||||
run: mvn clean
|
||||
- name: Build sdk
|
||||
run: mvn compile -q
|
||||
- name: Install jars
|
||||
run: mvn install -q
|
||||
- name: Validate invoke http example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/invoke/http/README.md
|
||||
- name: Validate invoke grpc example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/invoke/grpc/README.md
|
||||
- name: Validate tracing example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/tracing/README.md
|
||||
- name: Validate expection handling example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/exception/README.md
|
||||
- name: Validate state example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/state/README.md
|
||||
- name: Validate pubsub HTTP example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/pubsub/http/README.md
|
||||
- name: Validate bindings HTTP example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/bindings/http/README.md
|
||||
- name: Validate secrets example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/secrets/README.md
|
||||
- name: Validate unit testing example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/unittesting/README.md
|
||||
- name: Validate Configuration API example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/configuration/grpc/README.md
|
||||
- name: Validate query state HTTP example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/querystate/README.md
|
||||
dapr run --components-path=.components/ python3 github_metrics.py
|
Loading…
Reference in New Issue