Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarobernal2412 authored Nov 12, 2024
0 parents commit 6173c67
Show file tree
Hide file tree
Showing 53 changed files with 7,872 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Base FIS Codespace",
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"installDockerComposeSwitch": false
},
"ghcr.io/devcontainers/features/node:1": {
"version": "22",
"npm": "latest"
}
},
"hostRequirements": {
"cpus": 8
}
}
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MONGOADMIN=
MONGOPASS=
MONGOURL=mongodb://ADMIN:PASS@mongodb:27017/YOUR_SERVICE?authSource=admin
NODE_ENV=development
KAFKA_HOST=localhost:9092
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @adrrf @alvarobernal2412
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug Report
about: Report a bug in this microservice
title: "[BUG] "
labels: 🐞 Bug
assignees: ""
---

## Description

[Provide a clear and concise description of the bug]

## Steps to Reproduce

1. [First Step]
2. [Second Step]
3. [and so on...]

## Expected Behavior

[What you expected to happen]

## Actual Behavior

[What actually happened]

## Context

- OS: [e.g. iOS]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature Request
about: Suggest a new feature for this microservice
title: "[FEATURE] "
labels: 👀 Feature Requested
assignees: ""
---

## Feature Description

[Briefly describe the feature you want to request]

## Definition of Done

[What are the requirements for this feature to be considered complete?]
63 changes: 63 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
- name: 👀 Feature Requested
description: Request for a feature
color: 07D90A
- name: ignore-for-release
description: Ignore pull request for a new release
color: 9C28FC
- name: ✅ To-do
description: Action we need to perform at some moment
color: 82FC28
- name: 💻 Source
description: Indicates the scope is related to the own service logic
color: FDC720
- name: 🧪 Tests
description: Indicates the scope is related to the tests
color: 088E26
- name: ⚙️ Configuration
description: Indicates the scope is related to the configuration
color: BDBDBD
- name: 🛠️ Build
description: Indicates the change is related to the build
color: 0FD4DA
- name: 🐳 Dockerize
description: Indicates that the pull request is going to be dockerized
color: 0FD4DA
- name: 🚀 CI/CD
description: Indicates the change is related to CI/CD workflows
color: FF4D4D
- name: 🏠 Github Configuration
description: Indicates the change is related to github settings
color: 555555
- name: 🚀 Feature
description: Feature added in the PR
color: F10505
- name: 🐞 Bug
description: Bug identified
color: F4D03F
- name: 🕵🏻 Fix
description: Fix applied in the PR
color: F4D03F
- name: ⚠️ Breaking Change
description: Breaking change in the PR
color: F1F800
- name: 📦 Dependencies
description: Pull requests that update a dependency file
color: 95A5A6
- name: 🔒 Security
description: Pull requests that update a security dependency
color: 95A5A6
- name: 📝 Documentation
description: Improvements or additions to documentation
color: 228AFF
- name: 🤦‍ Duplicate
description: This issue or pull request already exists
color: 17202A
- name: 😎 size/m
description: Pull request size M
color: F1C40F
- name: 😖 size/l
description: Pull request size L
color: F39C12
- name: 🤯 size/xl
description: Pull request size XL
color: E67E22
47 changes: 47 additions & 0 deletions .github/pr-scope-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
🧪 Tests:
- changed-files:
- any-glob-to-any-file:
- tests/**

📝 Documentation:
- changed-files:
- any-glob-to-any-file:
- README.md

🐳 Build:
- changed-files:
- any-glob-to-any-file:
- .dockerignore
- Dockerfile
- docker-compose.yml

⚙️ Configuration:
- changed-files:
- any-glob-to-any-file:
- .dockerignore
- .env.example
- .gitignore
- vitest.config.**.ts
- create-vitest-test-config.ts
- commitlint.config.ts

📦 Dependencies:
- changed-files:
- any-glob-to-any-file:
- package.json
- package-lock.json

🚀 CI/CD:
- changed-files:
- any-glob-to-any-file:
- .github/workflows/**
- .github/renovate.json
- .github/pr-scope-labeler.yml
- .husky/**

🏠 Github Configuration:
- changed-files:
- any-glob-to-any-file:
- .github/ISSUE_TEMPLATE/**
- .github/CODEOWNERS
- .github/labels.yml
47 changes: 47 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"timezone": "Europe/Madrid",
"packageRules": [
{
"matchManagers": ["npm"],
"matchDepTypes": ["devDependencies"],
"groupName": "npm (development)"
},
{
"matchManagers": ["npm"],
"matchDepTypes": ["dependencies"],
"groupName": "npm (runtime)"
},
{
"matchManagers": ["github-actions"],
"separateMajorMinor": false,
"groupName": "ci"
},
{
"matchUpdateTypes": ["lockFileMaintenance"],
"groupName": "lockfiles",
"dependencyDashboardApproval": true
}
],
"dependencyDashboard": true,
"prConcurrentLimit": 0,
"prHourlyLimit": 0,
"osvVulnerabilityAlerts": true,
"vulnerabilityAlerts": {
"enabled": true,
"groupName": "vulnerable",
"labels": ["🔒 Security", "📦 Dependencies"]
},
"ignoreDeps": ["npm", "node"],
"enabledManagers": ["npm", "github-actions"],
"labels": ["📦 Dependencies"],
"rebaseWhen": "behind-base-branch",
"rangeStrategy": "pin",
"lockFileMaintenance": {
"enabled": true,
"groupName": "lockfiles",
"schedule": ["every month"]
},
"assignees": ["alvarobernal2412"],
"reviewers": ["adrrf"],
"extends": ["mergeConfidence:age-confidence-badges"]
}
42 changes: 42 additions & 0 deletions .github/workflows/api-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 📚 OpenAPI Documentation

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- 'openapi.yaml'

jobs:

generate-documentation:
runs-on: ubuntu-latest

permissions:
contents: write
packages: write
attestations: write
id-token: write

steps:
- name: Checkout ⬇️
uses: actions/checkout@v4.2.2
with:
show-progress: false

- name: 📥 Generate OpenAPI Documentation
run: |
npm install -g openapi-to-md
npx openapi-to-md -s openapi.yaml openapi.md
- name: 📤 Commit changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
files: openapi.md
message: 'docs(api): updated openapi.md 📝'
branch: ${{ github.head_ref || 'main' }}
83 changes: 83 additions & 0 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
tags:
- "*.*.*"
pull_request:
branches:
- main
types:
- labeled

env:
REGISTRY_IMAGE: ${{ secrets.DOCKER_USERNAME }}/AQUÍ_VA_EL_NOMBRE_DE_TU_IMAGEN_SIN_MAYUSCULAS
GHCR_IMAGE: fis2425/AQUÍ_VA_EL_NOMBRE_DE_TU_IMAGEN_SIN_MAYUSCULAS
PR_ID: ${{ github.event.pull_request.number }}
TAG: ${{ github.ref_name }}

jobs:
build:
runs-on: ubuntu-latest
if: (github.event.pull_request && github.event.label.name == '🐳 Dockerize') || github.event_name == 'push'

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout ⬇️
uses: actions/checkout@v4.2.2
with:
show-progress: false

- name: Configure QEMU ⚙️
uses: docker/setup-qemu-action@v3.2.0

- name: Configure Docker Buildx ⚙️
uses: docker/setup-buildx-action@v3.7.1

- name: Login to DockerHub 🔑
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry 🔑
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ startsWith(github.ref, 'refs/tags/') && format('{0}:{1}', env.REGISTRY_IMAGE, env.TAG) || '' }}
${{ github.ref == 'refs/heads/main' && format('{0}:latest', env.REGISTRY_IMAGE) || '' }}
${{ github.event_name == 'pull_request' && format('{0}:PR.{1}', env.REGISTRY_IMAGE, env.PR_ID) || '' }}
- name: Build and Push Ghcr Image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ startsWith(github.ref, 'refs/tags/') && format('ghcr.io/{0}:{1}', env.GHCR_IMAGE, env.TAG) || '' }}
${{ github.ref == 'refs/heads/main' && format('ghcr.io/{0}:latest', env.GHCR_IMAGE) || '' }}
${{ github.event_name == 'pull_request' && format('ghcr.io/{0}:PR.{1}', env.GHCR_IMAGE, env.PR_ID) || '' }}
17 changes: 17 additions & 0 deletions .github/workflows/pr-scope-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "PR Scope label"

on:
pull_request_target:
types: [opened, synchronize, reopened]

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
configuration-path: .github/pr-scope-labeler.yml
sync-labels: true
Loading

0 comments on commit 6173c67

Please sign in to comment.