Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci/add pipelines #48

Merged
merged 9 commits into from
Nov 3, 2024
Merged

Ci/add pipelines #48

merged 9 commits into from
Nov 3, 2024

Conversation

werlleyg
Copy link
Owner

@werlleyg werlleyg commented Nov 3, 2024

Summary by CodeRabbit

  • Novos Recursos

    • Adicionados novos fluxos de trabalho no GitHub Actions para automatizar a verificação de pull requests e gerenciamento de versões.
    • O fluxo de trabalho Develop PR Check valida pull requests para o branch develop.
    • O fluxo de trabalho Main PR Check automatiza testes e comparação de versões para pull requests no branch main.
    • O fluxo de trabalho Version Check and Create Tag cria tags automaticamente com base na versão do projeto.
  • Correções de Bugs

    • Atualização da versão do projeto de "0.1.0" para "0.0.1".
  • Melhorias

    • A propriedade debounceTime agora garante que o valor seja sempre numérico, melhorando a consistência do tipo.

@werlleyg werlleyg self-assigned this Nov 3, 2024
Copy link

coderabbitai bot commented Nov 3, 2024

Warning

Rate limit exceeded

@werlleyg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 53 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5174d8f and 88d9853.

Walkthrough

Foram introduzidos novos arquivos de workflow do GitHub Actions para automatizar processos de integração contínua e verificação de versão em pull requests. O arquivo develop-pr.yaml é acionado em pull requests para o branch develop, realizando checagens de código, instalação de dependências, construção do projeto e execução de testes. O arquivo main-pr.yaml é para pull requests no branch main, incluindo um trabalho de comparação de versões. Um terceiro arquivo, main-version.yaml, verifica e cria tags com base na versão do projeto. Além disso, o campo de versão no package.json foi atualizado.

Changes

Arquivo Resumo das Mudanças
.github/workflows/develop-pr.yaml Novo workflow Develop PR Check adicionado; job test-project com etapas para checar código, instalar dependências, construir o projeto e rodar testes.
.github/workflows/main-pr.yaml Novo workflow Main PR Check adicionado; jobs test-project e compare_versions com etapas para checar código, instalar dependências, construir o projeto e comparar versões. Variáveis de saída create_tag, version, latest_tag adicionadas.
.github/workflows/main-version.yaml Novo workflow Version Check and Create Tag adicionado; jobs check_version e create_tag para verificar a versão e criar uma nova tag se necessário.
package.json Campo version atualizado de "0.1.0" para "0.0.1".
src/main/config/environment.ts Propriedade debounceTime atualizada para garantir que seja sempre um valor numérico.

Poem

🐰 Em um campo de código a brilhar,
Novos workflows vêm a dançar.
Com versões a checar e tags a criar,
O projeto avança, pronto a brilhar!
Com um toque de magia e um pouco de amor,
Cada mudança traz um novo sabor! ✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (3)
.github/workflows/main-pr.yaml (1)

30-46: Especificar a versão exata do Node.js

Para garantir maior consistência e reprodutibilidade, é recomendável especificar a versão exata do Node.js ao invés de usar apenas "18".

Sugestão de correção:

  - name: Set up Node.js
    uses: actions/setup-node@v3
    with:
-     node-version: "18"
+     node-version: "18.x"
.github/workflows/main-version.yaml (2)

44-69: Aprimorar a lógica de comparação de versões

A lógica de comparação atual, embora funcional, pode ser melhorada para maior clareza e manutenibilidade.

Sugestão de refatoração:

  - name: Compare versions
    id: compare_versions
    run: |
-     echo "Comparing versions..."
-     VERSION=${{ env.VERSION }}
-     LATEST_TAG=${{ env.LATEST_TAG }}
-     VERSION_PADDED=$(printf "%s\n" "$VERSION" | awk -F. '{printf("%04d%04d%04d", $1, $2, $3)}')
-     LATEST_TAG_PADDED=$(printf "%s\n" "$LATEST_TAG" | awk -F. '{printf("%04d%04d%04d", $1, $2, $3)}')
-     echo "Padded Project version: $VERSION_PADDED"
-     echo "Padded Latest tag version: $LATEST_TAG_PADDED"
-     if [ "$VERSION_PADDED" -gt "$LATEST_TAG_PADDED" ]; then
-       echo "Project version $VERSION is greater than latest tag $LATEST_TAG"
-       echo "::set-output name=create_tag::true"
-     else
-       echo "Project version $VERSION is not greater than latest tag $LATEST_TAG"
-       echo "::set-output name=create_tag::false"
-       exit 1
-     fi
+     VERSION="${{ env.VERSION }}"
+     LATEST_TAG="${{ env.LATEST_TAG }}"
+     
+     # Função para converter versão em número para comparação
+     version_to_number() {
+       echo "$1" | awk -F. '{ printf("%04d%04d%04d", $1, $2, $3) }'
+     }
+     
+     VERSION_NUM=$(version_to_number "$VERSION")
+     LATEST_TAG_NUM=$(version_to_number "$LATEST_TAG")
+     
+     echo "Comparando versões:"
+     echo "Versão do projeto: $VERSION -> $VERSION_NUM"
+     echo "Última tag: $LATEST_TAG -> $LATEST_TAG_NUM"
+     
+     if [ "$VERSION_NUM" -gt "$LATEST_TAG_NUM" ]; then
+       echo "create_tag=true" >> $GITHUB_OUTPUT
+     else
+       echo "create_tag=false" >> $GITHUB_OUTPUT
+       exit 1
+     fi
🧰 Tools
🪛 actionlint

46-46: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


46-46: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


70-93: Adicionar tratamento de erros na criação de tags

A lógica de criação de tags está correta, mas pode se beneficiar de tratamento de erros adicional.

Sugestão de melhoria:

  - name: Create and push tag
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: |
      TAG="v${{ needs.check_version.outputs.version }}"
+     
+     # Verificar se a tag já existe localmente
+     if git rev-parse "$TAG" >/dev/null 2>&1; then
+       echo "Tag $TAG já existe localmente"
+       exit 1
+     fi
+     
+     # Verificar se a tag existe remotamente
+     if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "$TAG"; then
+       echo "Tag $TAG já existe no repositório remoto"
+       exit 1
+     fi
      
      # Create a new tag
-     git tag $TAG
+     git tag "$TAG" || {
+       echo "Erro ao criar a tag $TAG"
+       exit 1
+     }
      
      # Push the tag to the remote repository
-     git push origin $TAG
+     git push origin "$TAG" || {
+       echo "Erro ao enviar a tag $TAG para o repositório remoto"
+       git tag -d "$TAG"
+       exit 1
+     }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d12d84b and 5174d8f.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/develop-pr.yaml (1 hunks)
  • .github/workflows/main-pr.yaml (1 hunks)
  • .github/workflows/main-version.yaml (1 hunks)
  • package.json (1 hunks)
  • src/main/config/environment.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/main/config/environment.ts
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/develop-pr.yaml
  • package.json
🧰 Additional context used
🪛 actionlint
.github/workflows/main-pr.yaml

49-49: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)


49-49: shellcheck reported issue in this script: SC2086:info:3:27: Double quote to prevent globbing and word splitting

(shellcheck)


56-56: shellcheck reported issue in this script: SC2001:style:6:13: See if you can use ${variable//search/replace} instead

(shellcheck)


56-56: shellcheck reported issue in this script: SC2086:info:6:18: Double quote to prevent globbing and word splitting

(shellcheck)


56-56: shellcheck reported issue in this script: SC2086:info:7:33: Double quote to prevent globbing and word splitting

(shellcheck)


56-56: shellcheck reported issue in this script: SC2086:info:8:32: Double quote to prevent globbing and word splitting

(shellcheck)


68-68: shellcheck reported issue in this script: SC2086:info:17:29: Double quote to prevent globbing and word splitting

(shellcheck)


68-68: shellcheck reported issue in this script: SC2086:info:20:30: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/main-version.yaml

27-27: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)


27-27: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


34-34: shellcheck reported issue in this script: SC2001:style:6:13: See if you can use ${variable//search/replace} instead

(shellcheck)


34-34: shellcheck reported issue in this script: SC2086:info:6:18: Double quote to prevent globbing and word splitting

(shellcheck)


34-34: shellcheck reported issue in this script: SC2086:info:7:33: Double quote to prevent globbing and word splitting

(shellcheck)


34-34: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


46-46: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


46-46: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

🪛 yamllint
.github/workflows/main-pr.yaml

[error] 89-89: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
.github/workflows/main-pr.yaml (1)

1-7: Configuração do workflow aprovada!

A configuração do gatilho está correta, acionando o workflow apenas para pull requests direcionados ao branch main.

.github/workflows/main-version.yaml (1)

1-7: Configuração do workflow aprovada!

A configuração do gatilho está correta para execução apenas no branch main, o que é apropriado para gerenciamento de versões.

.github/workflows/main-pr.yaml Outdated Show resolved Hide resolved
.github/workflows/main-pr.yaml Show resolved Hide resolved
.github/workflows/main-pr.yaml Show resolved Hide resolved
.github/workflows/main-version.yaml Show resolved Hide resolved
.github/workflows/main-version.yaml Show resolved Hide resolved
@werlleyg werlleyg linked an issue Nov 3, 2024 that may be closed by this pull request
@werlleyg werlleyg merged commit a0f9ddc into develop Nov 3, 2024
1 check passed
@werlleyg werlleyg deleted the ci/add-pipelines branch November 3, 2024 14:17
@werlleyg werlleyg restored the ci/add-pipelines branch November 3, 2024 14:17
@werlleyg werlleyg deleted the ci/add-pipelines branch November 3, 2024 14:17
This was referenced Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci/add-pipelines
1 participant