Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
52bee3f
Merge pull request #90 from hemicharly/main
hemicharly Dec 31, 2024
a7221bd
Merge pull request #92 from hemicharly/main
hemicharly Jan 1, 2025
8b451d7
Merge pull request #94 from hemicharly/main
hemicharly Jan 1, 2025
b31e31b
Merge pull request #96 from hemicharly/main
hemicharly Jan 2, 2025
e0e48da
Merge pull request #98 from hemicharly/main
hemicharly Jan 2, 2025
e0b2401
Merge pull request #101 from hemicharly/main
hemicharly Jan 2, 2025
ffe4ed9
Merge pull request #104 from hemicharly/main
hemicharly Jan 2, 2025
623d57c
Merge pull request #106 from hemicharly/main
hemicharly Jan 2, 2025
11d8162
Merge pull request #108 from hemicharly/main
hemicharly Jan 2, 2025
ba2b7ee
feat: add badge test coverage
hemicharly Jan 3, 2025
38dfeac
Merge pull request #110 from hemicharly/feature/add-badges-test
hemicharly Jan 3, 2025
8e86878
feat: add badge test coverage
hemicharly Jan 3, 2025
d9dfe25
Merge pull request #112 from hemicharly/feature/add-badges-test
hemicharly Jan 3, 2025
7b6ed05
feat: add badge test coverage
hemicharly Jan 3, 2025
44a2510
feat: add badge test coverage
hemicharly Jan 3, 2025
5be3e3e
Merge pull request #114 from hemicharly/feature/add-badges-test
hemicharly Jan 3, 2025
5ee6e21
feat: add badge test coverage
hemicharly Jan 3, 2025
4f1f734
feat: add badge test coverage
hemicharly Jan 3, 2025
408af4f
Merge pull request #116 from hemicharly/feature/add-badges-test
hemicharly Jan 3, 2025
10466c7
chore: change git action
hemicharly Jan 3, 2025
7fb3808
chore: change git action
hemicharly Jan 3, 2025
c1abe5f
chore: update version to '' and test coverage badges
invalid-email-address Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .github/workflows/release-validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Validate Release

on:
pull_request:
types:
- opened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
test-coverage:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ steps.node-version.outputs.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Lint
run: yarn lint
- name: Format
run: yarn format
- name: Build
run: yarn build
- name: Test Coverage
run: yarn test:coverage
- name: Create badges
run: |
echo "Update badges readme file"
yarn readme:coverage
- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-files
path: |
app/coverage
app/test/badges

tag:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
needs:
- test-coverage
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Extract branch tag
id: tag
run: |
BRANCH=${{ github.head_ref }}
TAG="${BRANCH//release\//}"
echo $TAG
echo "tag=$TAG" >> $GITHUB_OUTPUT

update-version:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
needs:
- tag
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
env:
TAG: ${{ needs.tag.outputs.tag }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Update version in package.json
run: |
jq '.version = "${{ env.TAG }}"' package.json > temp.json && mv temp.json package.json
- name: Upload updated package.json
uses: actions/upload-artifact@v4
with:
name: updated-package-json
path: app/package.json

commit-push:
if: contains(github.head_ref, 'release/') && contains(github.base_ref, 'main')
needs:
- test-coverage
- update-version
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download coverage files
uses: actions/download-artifact@v4
with:
name: coverage-files
path: app
- name: Download updated package.json
uses: actions/download-artifact@v4
with:
name: updated-package-json
path: app
- name: Commit and push changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@github.com"

git checkout -B ${{ github.head_ref }} || git checkout -b ${{ github.head_ref }}

echo "Commit update version to '${{ env.TAG }}' and test coverage badges"
git add .
git commit -m "chore: update version to '${{ env.TAG }}' and test coverage badges"

git pull origin ${{ github.head_ref }} --rebase

git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}.git ${{ github.head_ref }}
64 changes: 0 additions & 64 deletions .github/workflows/update-version-package-json.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate
name: Validate Pull Request

on:
pull_request:
Expand All @@ -8,46 +8,36 @@ on:
branches:
- main
- develop
- "release/*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
validate-pr:
if: ${{ (github.event.pull_request.base.ref != 'develop' || github.event.pull_request.head.ref != 'main') && !(contains(github.head_ref, 'release/') && contains(github.base_ref, 'main'))}}
runs-on: ubuntu-latest
defaults:
run:
working-directory: app

if: ${{ github.event.pull_request.base.ref != 'develop' || github.event.pull_request.head.ref != 'main' }}

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22

- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

key: ${{ runner.os }}-node-${{ steps.node-version.outputs.node-version }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install

- name: Lint
run: yarn lint

- name: Format
run: yarn format

- name: Build
run: yarn build
- name: Test
run: yarn test

- name: Build
run: yarn build
11 changes: 10 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo "Running pre-commit..."

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)

if echo "$BRANCH_NAME" | grep -qE '^(feature|bugfix|release|hotfix|refactor|test)\/[a-z0-9-]+$'; then
if echo "$BRANCH_NAME" | grep -qE '^(feature|bugfix|release|hotfix|refactor|test)\/.*'; then
echo "✅ Valid branch name: $BRANCH_NAME"
else
echo "🚫 The branch name '$BRANCH_NAME' does not follow the Gitflow standard."
Expand All @@ -22,6 +22,15 @@ npm run lint:fix
echo "Running format fix..."
npm run format:fix

echo "Running build..."
npm run build

echo "Running test coverage..."
npm run test:coverage

echo "Running readme coverage update..."
npm run readme:coverage

# shellcheck disable=SC2103
cd ..

Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)

if echo "$BRANCH_NAME" | grep -qE '^(feature|bugfix|release|hotfix|refactor|test)\/[a-z0-9-]+$'; then
if echo "$BRANCH_NAME" | grep -qE '^(feature|bugfix|release|hotfix|refactor|test)\/.*'; then
echo "✅ Valid branch name: $BRANCH_NAME"
else
echo "🚫 The branch name '$BRANCH_NAME' does not follow the Gitflow standard."
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ test:
test-coverage:
docker compose -f yarn.cli.yml run --rm yarn test:coverage

# Run to update readme coverage
readme-coverage:
docker compose -f yarn.cli.yml run --rm yarn readme:coverage

# Updates all project libraries to their latest versions using Yarn,
# running in a container defined in the yarn.cli.yml file.
upgrade-lib:
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>


### Documentation available in languages

[![en](https://img.shields.io/badge/lang-en-blue.svg)](README.md)
[![pt-br](https://img.shields.io/badge/lang-pt--br-green.svg)](README.pt-br.md)

### Test Coverage

![Entrypoints](app/test/badges/entrypoints.svg)
![Core](app/test/badges/core.svg)
![Infrastructure](app/test/badges/infrastructure.svg)
![Shared](app/test/badges/shared.svg)

## Introduction

Expand Down
9 changes: 9 additions & 0 deletions README.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
[![en](https://img.shields.io/badge/lang-en-blue.svg)](README.md)
[![pt-br](https://img.shields.io/badge/lang-pt--br-green.svg)](README.pt-br.md)


### Cobertura de teste

![Entrypoints](app/test/badges/entrypoints.svg)
![Core](app/test/badges/core.svg)
![Infrastructure](app/test/badges/infrastructure.svg)
![Shared](app/test/badges/shared.svg)


## Introdução

Este projeto foi desenvolvido com fins didáticos, visando explorar e aprofundar o conhecimento no framework **NestJS**.
Expand Down
Loading
Loading