-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
# testing | ||
/coverage | ||
/metrics | ||
|
||
# next.js | ||
/.next/ | ||
|
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,33 @@ | ||
name: Generate Metrics Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
send-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Create Metrics SonarCloud | ||
run: node metrics/sonar-metrics.ts.mjs ${{ github.event.repository.name }} ${{ github.ref_name }} | ||
|
||
- name: Commit Metrics SonarCloud File | ||
run: | | ||
git config --global user.email "${{ secrets.USER_EMAIL }}" | ||
git config --global user.name "${{ secrets.USER_USERNAME }}" | ||
git clone --single-branch --branch main "https://x-access-token:${{ secrets.REPO_TOKEN }}@github.com/fga-eps-mds/2022-1-schedula-doc" docs | ||
mkdir -p docs/analytics-raw-data | ||
cp -R fga-eps-mds*.json docs/analytics-raw-data | ||
cd docs | ||
git add . | ||
git commit -m "Métricas SonarCloud - ${{ github.event.repository.name }} ${{ github.ref_name }}" | ||
git push | ||
echo "Metrics File Generated Successfully." |
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,51 @@ | ||
import fs from "fs" | ||
import https from "https" | ||
|
||
const base_url = | ||
"https://sonarcloud.io/api/measures/component_tree?component=fga-eps-mds_" | ||
const file_name = "fga-eps-mds" | ||
const metrics = [ | ||
"files", | ||
"functions", | ||
"complexity", | ||
"comment_lines_density", | ||
"duplicated_lines_density", | ||
"coverage", | ||
"ncloc", | ||
"tests", | ||
"test_errors", | ||
"test_failures", | ||
"test_execution_time", | ||
"security_rating" | ||
] | ||
|
||
console.log(process.argv.slice(2)) | ||
|
||
const [repository, version] = process.argv.slice(2) | ||
|
||
https | ||
.get(base_url + repository + `&metricKeys=${metrics.join(",")}`, (res) => { | ||
let data = "" | ||
res.on("data", (chunk) => { | ||
data += chunk | ||
}) | ||
res.on("end", () => { | ||
const date = new Date() | ||
const formatedDate = `${ | ||
date.getMonth() + 1 | ||
}-${date.getDate()}-${date.getFullYear()}-${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}` | ||
fs.writeFile( | ||
`${file_name}-${repository}-${formatedDate}-${version}.json`, | ||
data, | ||
function (err) { | ||
if (err) return console.log(err) | ||
console.log(err) | ||
} | ||
) | ||
|
||
return data | ||
}) | ||
}) | ||
.on("error", (err) => { | ||
console.log(err.message) | ||
}) |
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
34dffaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
2022-1-schedula-front – ./
2022-1-schedula-front-pedrok99.vercel.app
2022-1-schedula-front.vercel.app
2022-1-schedula-front-git-main-pedrok99.vercel.app