diff --git a/.github/workflows/label.yml b/.github/labeler.yml similarity index 100% rename from .github/workflows/label.yml rename to .github/labeler.yml diff --git a/.github/workflows/.gitmessage b/.github/workflows/.gitmessage new file mode 100644 index 0000000..b9db723 --- /dev/null +++ b/.github/workflows/.gitmessage @@ -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 +# +# 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 \ No newline at end of file diff --git a/.github/workflows/PR_TEMPLATE/pull_request_template.md b/.github/workflows/PR_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..651219a --- /dev/null +++ b/.github/workflows/PR_TEMPLATE/pull_request_template.md @@ -0,0 +1,34 @@ +## Purpose + + + +## Details + + + +- +- + +## Dependencies + + + +## Future Improvements + + + +## Mentions + + + + + +## Developer's checklist 📃 +- [ ] Followed the [coding guidelines](https://google.github.io/styleguide/jsguide.html). +- [ ] Properly commented the code. +- [ ] No print statements in the code. +- [ ] 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 diff --git a/.github/workflows/commit_rules.yml b/.github/workflows/commit_rules.yml new file mode 100644 index 0000000..51b0cde --- /dev/null +++ b/.github/workflows/commit_rules.yml @@ -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" diff --git a/.github/workflows/dev_test.yml b/.github/workflows/dev_test.yml new file mode 100644 index 0000000..9669c48 --- /dev/null +++ b/.github/workflows/dev_test.yml @@ -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 diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 0000000..7e34d5b --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -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