Skip to content

Commit

Permalink
ci: add ci pipeline for build all services
Browse files Browse the repository at this point in the history
  • Loading branch information
meysamhadeli committed Dec 9, 2023
1 parent 53c19d9 commit 74728cd
Show file tree
Hide file tree
Showing 13 changed files with 314 additions and 9 deletions.
111 changes: 111 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
# https://github.com/release-drafter/release-drafter/issues/551
# https://github.com/release-drafter/release-drafter/pull/1013
# https://github.com/release-drafter/release-drafter/issues/139
# https://github.com/atk4/data/blob/develop/.github/release-drafter.yml

# This release drafter follows the conventions from https://keepachangelog.com, https://common-changelog.org/
# https://www.conventionalcommits.org

name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## What Changed 👀
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: 🧪 Test
labels:
- test
- title: 👷 CI
labels:
- ci
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 📝 Other changes
## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934

# https://www.trywilco.com/post/wilco-ci-cd-github-heroku
# https://github.com/release-drafter/release-drafter#autolabeler
# https://github.com/fuxingloh/multi-labeler

# Using regex for defining rules - https://regexr.com/ - https://regex101.com/
autolabeler:
- label: 'chore'
branch:
- '/(chore)\/.*/'
- label: 'security'
branch:
- '/(security)\/.*/'
- label: 'refactor'
branch:
- '/(refactor)\/.*/'
- label: 'docs'
branch:
- '/(docs)\/.*/'
- label: 'ci'
branch:
- '/(ci)\/.*/'
- label: 'test'
branch:
- '/(test)\/.*/'
- label: 'bug'
branch:
- '/(fix)\/.*/'
- label: 'feature'
branch:
- '/(feat)\/.*/'
- label: 'minor'
branch:
- '/(feat)\/.*/'
- label: 'patch'
branch:
- '/(fix)\/.*/'
body:
- '/JIRA-[0-9]{1,4}/'

change-template: '- $TITLE (#$NUMBER)'
exclude-contributors:
- 'meysamhadeli'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- major
minor:
labels:
- minor
patch:
labels:
- patch
default: patch

exclude-labels:
- skip-changelog
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches: [ "main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
pull_request:
branches: [ "main" ]

jobs:

ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: build building-blocks
run: |
npm install
npm run build
working-directory: ./src/building-blocks

- name: build identity
run: |
npm install
npm run build
working-directory: ./src/identity

- name: build flight
run: |
npm install
npm run build
working-directory: ./src/flight

- name: build passenger
run: |
npm install
npm run build
working-directory: ./src/passenger

- name: build booking
run: |
npm install
npm run build
working-directory: ./src/booking

# - name: test identity
# run: npm test
# working-directory: ./src/identity


21 changes: 21 additions & 0 deletions .github/workflows/release-drafter-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Drafter Auto Labeler

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:
auto-labeler:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
disable-releaser: true # only run auto-labeler for PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
name: Release Drafter

on:
push:
branches:
- main

jobs:
update_release_draft:
name: Release drafter
runs-on: ubuntu-latest

steps:
- name: Update Release Draft
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# booking-microservices-nestjs
<div align="center" style="margin-bottom:20px">
<img src="assets/logo.png" alt="booking-microservices-nestjs" />
<div align="center">
<a href="https://github.com/meysamhadeli/booking-microservices-nestjs/actions/workflows/ci.yml"><img src="https://github.com/meysamhadeli/booking-microservices-nestjs/actions/workflows/ci.yml/badge.svg?branch=main&style=flat-square"/></a>
<a href="https://github.com/meysamhadeli/booking-microservices-nestjs/blob/main/LICENSE"><img src="https://img.shields.io/github/license/meysamhadeli/booking-microservices-nestjs?color=%234275f5&style=flat-square"/></a>
</div>
</div>
> **The main idea of creating this project is implementing an infrastructure for up and running distributed system with the latest technology and architecture like Vertical Slice Architecture, Event Driven Architecture, CQRS, Postgres, RabbitMq and Nestjs, and we will not deal mainly with business.** 🚀
## License
This project is made available under the MIT license. See [LICENSE](https://github.com/meysamhadeli/booking-microservices-nestjs/blob/main/LICENSE) for details.
Binary file added assets/booking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions deployments/docker-compose/infrastructure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: "3.3"
services:

#######################################################
# Rabbitmq
#######################################################
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
restart: unless-stopped
ports:
- 5672:5672
- 15672:15672
networks:
- booking


#######################################################
# Postgress
#######################################################
postgres:
container_name: postgres
image: postgres:latest
restart: unless-stopped
ports:
- '5432:5432'
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
networks:
- booking


#######################################################
# Jaeger
#######################################################
jaeger:
image: jaegertracing/all-in-one
container_name: jaeger
restart: unless-stopped
ports:
- 5775:5775/udp
- 5778:5778
- 6831:6831/udp
- 6832:6832/udp
- 9411:9411
- 14268:14268
- 16686:16686
networks:
- booking

#######################################################
# Zipkin
#######################################################
zipkin:
image: openzipkin/zipkin:latest
container_name: zipkin
restart: unless-stopped
ports:
- '9411:9411'
networks:
- booking

networks:
booking:




23 changes: 23 additions & 0 deletions deployments/monitoring/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
scrape_configs:
- job_name: identity
honor_timestamps: true
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:4000
- job_name: passenger
honor_timestamps: true
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:4001
3 changes: 1 addition & 2 deletions src/booking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"scripts": {
"build": "nest build",
"dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch",
"dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
},
Expand Down Expand Up @@ -65,7 +65,6 @@
"ts-mapper": "^1.2.4",
"tsyringe": "4.8.0",
"typeorm": "^0.3.17",
"win-node-env": "^0.6.1",
"yup": "1.3.2"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/flight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"scripts": {
"build": "nest build",
"dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch",
"dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
},
Expand Down Expand Up @@ -65,7 +65,6 @@
"tsyringe": "4.8.0",
"typeorm": "^0.3.17",
"typeorm-extension": "^3.2.0",
"win-node-env": "^0.6.1",
"yup": "1.3.2"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"scripts": {
"build": "nest build",
"dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch",
"dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
},
Expand Down Expand Up @@ -68,7 +68,6 @@
"tsyringe": "4.8.0",
"typemoq": "^2.1.0",
"typeorm": "^0.3.17",
"win-node-env": "^0.6.1",
"yup": "1.3.2"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/passenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"scripts": {
"build": "nest build",
"dev": "tsc -p tsconfig.json && NODE_ENV=development nodemon src/main.ts --watch",
"dev": "tsc -p tsconfig.json && nodemon src/main.ts --watch",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
},
Expand Down Expand Up @@ -64,7 +64,6 @@
"ts-mapper": "^1.2.4",
"tsyringe": "4.8.0",
"typeorm": "^0.3.17",
"win-node-env": "^0.6.1",
"yup": "1.3.2"
},
"devDependencies": {
Expand Down

0 comments on commit 74728cd

Please sign in to comment.