Skip to content

Commit

Permalink
Ft/workflow (#9)
Browse files Browse the repository at this point in the history
* Pr and commit message template

* chore: workflow - add test check

* Laberer error

* chore: workflow : build docker image

---------

Co-authored-by: Tushar <[email protected]>
  • Loading branch information
krishnan05 and tusharbansal22 authored Apr 1, 2024
1 parent ad9ff6a commit 3e14820
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 0 deletions.
File renamed without changes.
23 changes: 23 additions & 0 deletions .github/workflows/.gitmessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Title: Summary, imperative, start upper case, don't end with a period
# No more than 50 chars. #### 50 chars is here: #

# Remember blank line between title and body.

# Body: Explain *what* and *why* (not *how*). Include task ID (Jira issue).
# Wrap at 72 chars. ################################## which is here: #


# At the end: Include Co-authored-by for all contributors.
# Include at least one empty line before it. Format:
# Co-authored-by: name <[email protected]>
#
# How to Write a Git Commit Message:
# https://chris.beams.io/posts/git-commit/
#
# 1. Separate subject from body with a blank line
# 2. Limit the subject line to 50 characters
# 3. Capitalize the subject line
# 4. Do not end the subject line with a period
# 5. Use the imperative mood in the subject line
# 6. Wrap the body at 72 characters
# 7. Use the body to explain what and why vs. how
34 changes: 34 additions & 0 deletions .github/workflows/PR_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Purpose

<!--- Mention the purpose of the PR --->

## Details

<!--- Mention the details. If the details sections is large enough, then mention the details in bullets as follows: --->

- <!--- Update 1 --->
- <!--- Update 2 --->

## Dependencies

<!--- Mention any dependencies/packages used. If no dependency/package is used, write None. --->

## Future Improvements

<!--- Mention any improvements to be done in future related to any file/feature. If you believe that there are no further improvements, write None --->

## Mentions

<!--- Mention and tag the people. Type '@' and you will automatically get suggestions. Usually the mentions are for the person(s) by whom you wanted your PR to get reviewed. --->


<!-- Make sure to check all the items in Developer's checklist. If some box is left unchecked then mention the reason in front of the item -->
## Developer's checklist 📃
- [ ] Followed the [coding guidelines](https://google.github.io/styleguide/jsguide.html).
- [ ] Properly commented the code.
- [ ] No print statements in the code. <!-- If you have some print statements in the code then mention the reason here. -->
- [ ] All the functionalities are working properly.
- [ ] Changes made are not breaking any other part of the project.
- [ ] No UI/UX issues are present.
- [ ] Relevant screenshots are added in the PR.
- [ ] Followed the PR guidelines
15 changes: 15 additions & 0 deletions .github/workflows/commit_rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
rules:
- name: "Commit message length"
description: "Ensure commit messages are not too long"
pattern: ".{1,50}"
error_message: "Commit messages should be between 1 and 50 characters long"

- name: "Capitalized subject"
description: "Ensure commit message subject starts with a capital letter"
pattern: "^[A-Z].*"
error_message: "Commit message subject should start with a capital letter"

- name: "Imperative mood"
description: "Ensure commit message subject is in imperative mood"
pattern: "(^fix|^update|^add|^remove|^refactor|^implement|^merge|^resolve|^enhance|^correct|^optimize|^adjust|^improve|^change|^test|^doc|^style|^clean)(s|es|ed|ing)?\\b"
error_message: "Commit message subject should use imperative mood"
34 changes: 34 additions & 0 deletions .github/workflows/dev_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run Tests and Create .env.development

on:
push:
branches:
- dev
pull_request:
branches:
- dev

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: npm install

- name: Create .env.development file
run: |
echo "PORT=3000" >> .env.development
echo "MONGODB_URI=${{ secrets.MONGODB_URI }}" >> .env.development
echo "NODE_ENV=development" >> .env.development
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env.development
echo "ORIGIN=${{ secrets.ORIGIN }}" >> .env.development
echo "TWILIO_ACCOUNT_SID=${{ secrets.TWILIO_ACCOUNT_SID }}" >> .env.development
echo "TWILIO_AUTH_TOKEN=${{ secrets.TWILIO_AUTH_TOKEN }}" >> .env.development
echo "TWILIO_SERVICE_SID=${{ secrets.TWILIO_SERVICE_SID }}" >> .env.development
- name: Run Jest tests
run: npm test
40 changes: 40 additions & 0 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Update docker dev image

on:
push:
branches:
- dev

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: npm install

- name: Create .env.development file
run: |
echo "PORT=3000" >> .env.development
echo "MONGODB_URI=${{ secrets.MONGODB_URI }}" >> .env.development
echo "NODE_ENV=development" >> .env.development
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env.development
echo "ORIGIN=${{ secrets.ORIGIN }}" >> .env.development
echo "TWILIO_ACCOUNT_SID=${{ secrets.TWILIO_ACCOUNT_SID }}" >> .env.development
echo "TWILIO_AUTH_TOKEN=${{ secrets.TWILIO_AUTH_TOKEN }}" >> .env.development
echo "TWILIO_SERVICE_SID=${{ secrets.TWILIO_SERVICE_SID }}" >> .env.development
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/swifty-order-service .

- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/swifty-order-service

0 comments on commit 3e14820

Please sign in to comment.