Skip to content

Commit

Permalink
Merge branch 'graph-service-main' into mono-main
Browse files Browse the repository at this point in the history
  • Loading branch information
wilwade committed Jul 19, 2024
2 parents e116d22 + 0920871 commit 43841a3
Show file tree
Hide file tree
Showing 114 changed files with 22,825 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/services/graph" # Location of package manifests
schedule:
interval: "weekly"
65 changes: 65 additions & 0 deletions .github/workflows/build-graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "[Graph] Build And Test"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Build NestJS
run: npm run build
test_jest:
name: "Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Run Jest
run: npm run test
check_licenses:
name: "Dependency License Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
working-directory: services/graph
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: package-lock.json
- name: Install dependencies
working-directory: services/graph
run: npm ci
- name: License Check
working-directory: services/graph
# List all the licenses and error out if it is not one of the supported licenses
run: npx license-report --fields=name --fields=licenseType | jq 'map(select(.licenseType | IN("MIT", "Apache-2.0", "ISC", "BSD-3-Clause", "BSD-2-Clause", "(Apache-2.0 AND MIT)", "Apache-2.0 OR MIT") | not)) | if length == 0 then halt else halt_error(1) end'
77 changes: 77 additions & 0 deletions .github/workflows/release-graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: "[Graph] Release"
run-name: "[Graph] Cut Service Release ${{github.event.inputs.release-version || github.ref_name}}"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
on:
push:
tags:
- "graph-v[0-9]+.[0-9]+.[0-9]+" # ex. v1.0.0
- "graph-v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # ex. v1.1.0-rc1
- "graph-v0.0.1" # used for testing only
- "graph-v0.0.1-rc[0-9]+" # used for testing only
workflow_dispatch:
inputs:
release-version:
description: "Release version (graph-v#.#.#[-rc#])"
required: true

env:
NEW_RELEASE_TAG_FROM_UI: ${{github.event.inputs.release-version}}
TEST_RUN: ${{startsWith(github.event.inputs.release-version || github.ref_name, 'graph-v0.0.1')}}
DOCKER_HUB_PROFILE: amplicalabs
IMAGE_NAME: graph-service

jobs:
build-and-publish-container-image:
name: Build and publish container image
runs-on: ubuntu-latest
steps:
- name: Validate Version Tag
if: env.NEW_RELEASE_TAG_FROM_UI != ''
shell: bash
run: |
version=${{env.NEW_RELEASE_TAG_FROM_UI}}
echo "Release version entered in UI: $version"
regex='^graph-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-rc[1-9]\d*)?$'
if [[ ! $version =~ $regex ]]; then
echo "ERROR: Entered version $version is not valid."
echo "Please use v#.#.#[-rc#] format."
exit 1
fi
echo "valid-version=true" >> $GITHUB_OUTPUT
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.NEW_RELEASE_TAG_FROM_UI}}
- name: Set up tags for cp image
id: cp-tags
uses: docker/metadata-action@v5
with:
flavor: |
latest=auto
images: |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: |
linux/amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME_FC}}
password: ${{secrets.DOCKERHUB_TOKEN_FC}}
- name: Build and Push graph-service-service Image
uses: docker/build-push-action@v5
with:
working-directory: services/graph
context: .
platforms: linux/amd64
push: ${{env.TEST_RUN != 'true'}}
file: ./Dockerfile
tags: ${{ steps.cp-tags.outputs.tags }}
9 changes: 9 additions & 0 deletions services/graph/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
dist
.env*
env.template
**/node_modules
**/test
64 changes: 64 additions & 0 deletions services/graph/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"airbnb-base",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"settings": {
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"directory": "./tsconfig.json"
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".d.ts", ".tsx"]
}
},
"react": {
"version": "999.99.99"
}
},
"rules": {
"no-console": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import/no-unresolved": [2, { "commonjs": true, "amd": true }],
"import/named": 2,
"import/namespace": 2,
"import/default": 2,
"import/export": 2,
"import/prefer-default-export": "off",
"indent": "off",
"no-unused-vars": "off",
"prettier/prettier": 2
},
"plugins": ["import", "prettier"]
}
138 changes: 138 additions & 0 deletions services/graph/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Ignore generated docs
docs/*.html

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.dev
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.idea/

.vscode/

10 changes: 10 additions & 0 deletions services/graph/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 180,
"tabWidth": 2,
"useTabs": false
}
1 change: 1 addition & 0 deletions services/graph/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.12.2
Loading

0 comments on commit 43841a3

Please sign in to comment.