Skip to content

Commit

Permalink
Merge branch 'main' into build-on-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
ipc103 authored Mar 6, 2024
2 parents 9b296c3 + bfd2fbc commit becdc97
Show file tree
Hide file tree
Showing 44 changed files with 9,078 additions and 638 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
34 changes: 12 additions & 22 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
- name: Setup Node for metrics backend
uses: actions/setup-node@v4
with:
go-version: ^1.19
- name: Get dependencies
run: |
cd backend
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build Go
run: make build
# - name: Test
# run: make test
- name: Run Go program and save output
id: run
node-version: "20.x"
- name: Collect metrics and save output
id: metrics
run: |
$PWD/backend/bin/metrics
cd ts-backend
npm i
npm start
- name: Detect package manager
id: detect-package-manager
run: |
Expand All @@ -77,11 +67,11 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "16"
node-version: "20.x"
cache: ${{ steps.detect-package-manager.outputs.manager }}
cache-dependency-path: ${{ steps.detect-package-manager.outputs.cache-dependency-path }}
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
Expand All @@ -105,7 +95,7 @@ jobs:
- name: Static HTML export with Next.js
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.runner }} next export
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: "${{ github.workspace }}/who-metrics-ui/out"

Expand All @@ -121,4 +111,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
38 changes: 23 additions & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch metrics (local)",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/backend/cmd/main.go",
"envFile": "${workspaceFolder}/dev.vscode.env",
},
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch metrics (local)",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/backend/cmd/main.go",
"envFile": "${workspaceFolder}/dev.vscode.env"
},
{
"name": "Next.js: debug metrics",
"type": "node-terminal",
"request": "launch",
"cwd": "${workspaceFolder}/ts-backend",
"command": "npm run start",
"envFile": "${workspaceFolder}/ts-backend/.env"
}
]
}
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 GitHub Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ metrics:

test-go:
@echo "==> running Go tests <=="
CGO_ENABLED=1 go test -p 64 -race ./backend/...
CGO_ENABLED=1 cd backend && go test -p 64 -race ./...

dev:
@echo "==> Generating data"
cd backend && go build -o ./bin/metrics ./cmd && cd .. && ./backend/bin/metrics && cd who-metrics-ui && npm i && npm run dev
73 changes: 41 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,62 @@ Monitor open source health across different projects to have a high level view t

Issue Project [here](https://github.com/github/SI-skills-based-volunteering/issues/147#issuecomment-1472370039)


## Team
<table>
<tr>
<td colspan=3 align=center>
<img src="https://avatars.githubusercontent.com/u/12959012?v=4" width="110" height="110"><br/><br/>
<tr valign="top">
<td align=center>
<img src="https://avatars.githubusercontent.com/u/12959012?v=4" width="110" height="110"><br/>
<a href="https://github.com/liliana3186">@liliana3186</a><br/>
</b>Liliana Torres<br>
Liliana Torres<br/>
<b>Project Lead, Senior Data Analyst </b>
</td>
<td colspan=3 align=center>
<img src="https://avatars.githubusercontent.com/u/34780972?v=4 width="110" height="110" ><br/>
<td align=center>
<img src="https://avatars.githubusercontent.com/u/34780972?v=4" width="110" height="110"><br/>
<a href="https://github.com/hasan-dot">@hasan-dot</a><br/>
</b>Hassan Hawache<br>
<b> Sofware Engineer III</b>
Hassan Hawache<br/>
<b>Sofware Engineer III</b>
</td>
<td colspan=3 align=center>
<td align=center>
<img src="https://avatars.githubusercontent.com/u/61184284?v=4" width="110" height="110"><br/>
<a href="https://github.com/darostegui">@daristegui</a><br/>
</b>Diego Arostegui<br>
<a href="https://github.com/darostegui">@darostegui</a><br/>
Diego Arostegui<br/>
<b>Customer Reliability Engineer III</b>
</td>
<td colspan=3 align=center>
<td align=center>
<img src="https://avatars.githubusercontent.com/u/24923406?v=4" width="110" height="110"><br/>
<a href="https://github.com/ajhenry">@ajhenry</a><br/>
</b>Andrew Henry<br>
Andrew Henry<br/>
<b> Senior Software Engineer </b>
</td>
<td colspan=3 align=center>
<td align=center>
<img src="https://avatars.githubusercontent.com/u/67866556?v=4" width="110" height="110"><br/>
<a href="https://github.com/joannaakl">@joannaakl</a><br/>
</b>Joanna Krzek-Lubowiecka<br>
Joanna Krzek-Lubowiecka<br/>
<b> Software Engineer III </br>
</td>
<td colspan=3 align=center>
<img src="https://avatars.githubusercontent.com/u/22037769?v=4 width="110" height="110"><br/>
<td align=center>
<img src="https://avatars.githubusercontent.com/u/22037769?v=4" width="110" height="110"><br/>
<a href="https://github.com/dmgardiner25">@dmgardiner25</a><br/>
</b>David Gardiner<br>
David Gardiner<br/>
<b> Software Engineer II</b>
</td>
<td colspan=3 align=center>
<td align=center>
<img src="https://github.com/ipc103.png?v=4" width="110" height="110"><br/>
<a href="https://github.com/ipc103">@ipc103</a><br/>
</b>Ian Candy<br>
Ian Candy<br/>
<b> Senior Software Engineer</b>
</td>
</tr>
</table>






## Development in Codespaces

### UI

1. Run `cd who-metrics-ui && npm i`
2. Run `npm run dev`

<!-- TODO: Add min requirements and deployment steps -->
### Backend
### Go Backend

To update the repository data.
To update the repository data using the Go backend

1. Generate a [new GitHub Token](https://github.com/settings/tokens) with the ability to read repo, read org, and read projects scopes.
1. Set the `GRAPHQL_TOKEN` environment variable to be the value of your newly created token.
Expand All @@ -84,4 +75,22 @@ make build
./backend/bin/metrics
```

This will generate a new `data.json` file in the UI directory which can be imported directly as part of the static build.
This will generate a new `data.json` file in the UI directory which can be imported directly as part of the static build.\

### TypeScript Backend

To update the repository data using the TypeScript backend.

1. Generate a [new GitHub Token](https://github.com/settings/tokens) with the ability to read repo, read org, and read projects scopes.
1. Set the `GRAPHQL_TOKEN` environment variable to be the value of your newly created token.
1. `cd ts-backend && npm install && yarn start`. This will generate a `data.json` file in the `who-metrics-ui` directory.
1. `cd ../who-metrics-ui` and run `npm install && npm run dev` to start the server.

### UI

Run `make dev` to develop in the UI. This will:

1. Build the backend project using the steps above
1. Generate a new `data.json` file with the required data inside the frontend directory
1. Run the Next development server

1 change: 1 addition & 0 deletions backend/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"os"

_ "github.com/joho/godotenv/autoload"
"github.com/who-metrics/business/core"
"github.com/who-metrics/business/core/collectors/github"
"github.com/who-metrics/business/helpers"
Expand Down
1 change: 1 addition & 0 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (

require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 // indirect
golang.org/x/net v0.17.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
2 changes: 2 additions & 0 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/shurcooL/githubv4 v0.0.0-20230305132112-efb623903184 h1:QwdHPs+b2raoqIDBgAkjYw89KHH2/CXbV+m2qrbDi9k=
github.com/shurcooL/githubv4 v0.0.0-20230305132112-efb623903184/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo=
github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 h1:B1PEwpArrNp4dkQrfxh/abbBAOZBVp0ds+fBEOUOqOc=
Expand Down
3 changes: 3 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
organization: "WorldHealthOrganization"
since: "2008-01-01"
3 changes: 2 additions & 1 deletion dev.vscode.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GITHUB_GRAPHQL_TOKEN="TOKEN"
GRAPHQL_TOKEN="<YOUR TOKEN HERE>"
ORGANIZATION_NAME="your_organization"
1 change: 1 addition & 0 deletions ts-backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GRAPHQL_TOKEN=your_token
12 changes: 12 additions & 0 deletions ts-backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.cache
.DS_Store
.idea
*.log
*.tgz
coverage
dist
lib-cov
logs
node_modules
temp
*data.json
12 changes: 12 additions & 0 deletions ts-backend/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
],
declaration: true,
clean: true,
rollup: {
emitCJS: true,
},
})
Loading

0 comments on commit becdc97

Please sign in to comment.