CI: Fix frontend-metrics-step (attempt #1) (#74838)

* use grafana/public instead

* parameterise script (still need to fix + run drone locally)

* make drone

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
Kevin Minehart 2023-09-14 08:48:31 -05:00 committed by GitHub
parent af392c5886
commit 84d35e9f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -1885,8 +1885,9 @@ steps:
repo: repo:
- grafana/grafana - grafana/grafana
- commands: - commands:
- apk add --update bash grep - apk add --update bash grep git
- ./scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY - ./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics
$$GRAFANA_MISC_STATS_API_KEY
depends_on: depends_on:
- test-a11y-frontend - test-a11y-frontend
environment: environment:
@ -4188,6 +4189,6 @@ kind: secret
name: gcr_credentials name: gcr_credentials
--- ---
kind: signature kind: signature
hmac: a7e975025e17a664e3cdb5042d624c05c0f92b2e2f433db2c66bc7ebe2a2eca7 hmac: dd510a5bc713ecde460082403f309b93dcdcb823368e642bac07861eddbf051e
... ...

View File

@ -1,6 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
BUILD_FOLDER=$1
if [ -z "$BUILD_FOLDER" ]; then
BUILD_FOLDER="./public/build"
fi
ERROR_COUNT="0" ERROR_COUNT="0"
ACCESSIBILITY_ERRORS="$(grep -oP '\"errors\":(\d+),' pa11y-ci-results.json | grep -oP '\d+')" ACCESSIBILITY_ERRORS="$(grep -oP '\"errors\":(\d+),' pa11y-ci-results.json | grep -oP '\d+')"
DIRECTIVES="$(grep -r -o directive public/app/ | wc -l)" DIRECTIVES="$(grep -r -o directive public/app/ | wc -l)"
@ -10,7 +15,7 @@ CLASSNAME_PROP="$(grep -r -o -E --include="*.ts*" "\.*.className=\W.*\W.*" publi
EMOTION_IMPORTS="$(grep -r -o -E --include="*.ts*" --exclude="*.test*" "\{.*css.*\} from '@emotion/css'" public/app | wc -l)" EMOTION_IMPORTS="$(grep -r -o -E --include="*.ts*" --exclude="*.test*" "\{.*css.*\} from '@emotion/css'" public/app | wc -l)"
TS_FILES="$(find public/app -type f -name "*.ts*" -not -name "*.test*" | wc -l)" TS_FILES="$(find public/app -type f -name "*.ts*" -not -name "*.test*" | wc -l)"
TOTAL_BUNDLE="$(du -sk ./public/build | cut -f1)" TOTAL_BUNDLE="$(du -sk $BUILD_FOLDER | cut -f1)"
OUTDATED_DEPENDENCIES="$(yarn outdated --all | grep -oP '[[:digit:]]+ *(?= dependencies are out of date)')" OUTDATED_DEPENDENCIES="$(yarn outdated --all | grep -oP '[[:digit:]]+ *(?= dependencies are out of date)')"
## Disabled due to yarn PnP update breaking npm audit ## Disabled due to yarn PnP update breaking npm audit
#VULNERABILITY_AUDIT="$(yarn npm audit --all --recursive --json)" #VULNERABILITY_AUDIT="$(yarn npm audit --all --recursive --json)"

View File

@ -633,8 +633,8 @@ def frontend_metrics_step(trigger = None):
}, },
"failure": "ignore", "failure": "ignore",
"commands": [ "commands": [
"apk add --update bash grep", "apk add --update bash grep git",
"./scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY", "./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY",
], ],
} }
if trigger: if trigger: