Skip to content

Commit

Permalink
Merge pull request #128 from sbv-world-health-org-metrics/revert-114-…
Browse files Browse the repository at this point in the history
…ajhenry/cleanup

Revert "Rework directory structure"
  • Loading branch information
ipc103 authored Mar 26, 2024
2 parents e20377e + 89d4e0a commit 58eb551
Show file tree
Hide file tree
Showing 98 changed files with 2,685 additions and 17,545 deletions.
53 changes: 29 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
{
"name": "Typescript",
"build": {
"dockerfile": "Dockerfile"
},
"name": "Go",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"docker-in-docker": {
"version": "latest",
"moby": true
},
"azure-cli": "latest",
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},

"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {}
},
"extensions": [
"github.copilot",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
"docker-in-docker": {
"version": "latest",
"moby": true
},
"azure-cli": "latest",
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},

"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"gopls": { "ui.semanticTokens": true }
}
},
"extensions": [
"github.copilot",
"golang.go"
]
},
"postCreateCommand": "./script/install-tools.sh"
}
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

30 changes: 15 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ registries:
type: docker-registry
url: ghcr.io
username: PAT
password: '${{secrets.CONTAINER_BUILDER_TOKEN}}'
password: "${{secrets.CONTAINER_BUILDER_TOKEN}}"
updates:
- package-ecosystem: 'gomod'
directory: '/'
schedule:
interval: weekly
- package-ecosystem: docker
registries:
- ghcr
directory: '/'
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: docker
registries:
- ghcr
directory: "/"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
34 changes: 17 additions & 17 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 'CodeQL'
name: "CodeQL"

on:
push:
branches: ['main']
branches: [ "main" ]
pull_request:
branches: ['main']
branches: [ "main" ]

jobs:
analyze:
Expand All @@ -17,18 +17,18 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['javascript']
language: [ 'javascript', 'go' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{matrix.language}}'
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
36 changes: 24 additions & 12 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Deploy Next.js site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -23,7 +27,7 @@ env:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
group: "pages"
cancel-in-progress: false

jobs:
Expand All @@ -33,26 +37,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
- name: Setup Node for metrics backend
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: "20.x"
- name: Collect metrics and save output
id: metrics
run: |
cd backend
cd ts-backend
npm i
npm run dev
npm start
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/app/yarn.lock" ]; then
if [ -f "${{ github.workspace }}/who-metrics-ui/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
echo "cache-dependency-path=**/yarn.lock" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/app/package.json" ]; then
elif [ -f "${{ github.workspace }}/who-metrics-ui/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
Expand All @@ -62,6 +66,12 @@ jobs:
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
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@v4
with:
Expand All @@ -74,20 +84,22 @@ jobs:
uses: actions/cache@v3
with:
path: |
"${{ github.workspace }}/app/.next/cache"
"${{ github.workspace }}/who-metrics-ui/.next/cache"
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Next.js
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.runner }} next build
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.runner }} next build
- 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@v3
with:
path: '${{ github.workspace }}/app/out'
path: "${{ github.workspace }}/who-metrics-ui/out"

# Deployment job
deploy:
Expand Down
45 changes: 3 additions & 42 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Data files - these get generated at buildtime. The README includes instructions for generating these.
/src/data/data.json

.env*
!.env.example
*.env
tmp/*
sbv-world-health-org-metrics.code-workspace
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"golang.go",
"DavidAnson.vscode-markdownlint"
]
}
35 changes: 12 additions & 23 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,35 +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": "App: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "cd app && npm run dev"
},
{
"name": "App: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "App: debug full stack",
"type": "node-terminal",
"name": "Launch metrics (local)",
"type": "go",
"request": "launch",
"command": "cd app && npm run dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
"mode": "debug",
"program": "${workspaceFolder}/backend/cmd/main.go",
"envFile": "${workspaceFolder}/dev.vscode.env"
},
{
"name": "Backend: Debug",
"name": "Next.js: debug metrics",
"type": "node-terminal",
"request": "launch",
"command": "cd backend && npm run dev",
"envFile": "${workspaceFolder}/.env"
"cwd": "${workspaceFolder}/ts-backend",
"command": "npm run start",
"envFile": "${workspaceFolder}/ts-backend/.env"
}
]
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.format.enable": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "typescript", "typescriptreact", "json"],
"[javascript][typescript][typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"editor.tabSize": 2,
"editor.rulers": [
118
],
"typescript.tsdk": "who-metrics-ui/node_modules/typescript/lib",
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
}
Loading

0 comments on commit 58eb551

Please sign in to comment.