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

chore: improve dependency handling and use the DataGrip connector to MongoDB #6

Merged
merged 16 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@

eg. fix(type-hint): infer type of a constant for type checking INTELLIJ-1111
-->

## Description

<!--- Describe your changes in detail so reviewers have enough content on what this PR aims to achieve -->
<!--- If applicable, describe (or illustrate) architecture flow -->

### Checklist

- [ ] New tests and/or benchmarks are included.
- [ ] Documentation is changed or added.
- [ ] Changelog is updated accordingly.
- [ ] I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement).

## Open Questions

<!--- Any particular areas you'd like reviewers to pay attention to? -->
76 changes: 38 additions & 38 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,48 +40,48 @@ jobs:
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
matrix:
matrix:
include:
- language: java-kotlin
build-mode: autobuild
- language: java-kotlin
build-mode: autobuild

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended
config: |
paths:
- 'packages/**/src/**/*.kt'
- 'packages/**/src/**/*.java'
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended
config: |
paths:
- 'packages/**/src/**/*.kt'
- 'packages/**/src/**/*.java'

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
ls packages/jetbrains-plugin/build/distributions/jetbrains-plugin.zip

CHANGELOG=$(./gradlew --quiet --console=plain :packages:jetbrains-plugin:getChangelog)

gh release create "${RELEASE_TAG}" \
--title "${RELEASE_TAG}" \
--notes "${CHANGELOG}" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish Release

on:
release:
types: [published]
types: [ published ]

jobs:
prepare-release:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/quality-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
id: verify-changelog-files
with:
files: |
CHANGELOG.md
CHANGELOG.md
- uses: mheap/github-action-required-labels@v1
if: steps.verify-changed-files.outputs.files_changed == 'false'
with:
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
with:
name: unit-test-coverage
path: "**/jacocoTestReport.xml"

functional-tests:
name: 'Functional & UI Tests'
runs-on: ubuntu-latest
Expand Down
26 changes: 15 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Contributing

## Getting Started

You'll need at least the JDK 17 to work locally on the plugin. While the plugin should
Expand All @@ -22,7 +23,8 @@ It will take a few moments, and you are ready to go.

## Submitting Changes

MongoDB welcomes community contributions! If you’re interested in making a contribution to MongoDB's plugin for IntelliJ,
MongoDB welcomes community contributions! If you’re interested in making a contribution to MongoDB's plugin for
IntelliJ,
please follow the steps below before you start writing any code:

- Sign the contributor's agreement. This will allow us to review and accept contributions.
Expand All @@ -36,8 +38,9 @@ please follow the steps below before you start writing any code:

## Submitting Bugs

You can report new bugs by creating a new issue either in [JIRA](https://jira.mongodb.org/projects/INTELLIJ/issues/) or
[GitHub](https://github.com/mongodb-js/intellij/issues). Please include as much information as possible about your environment
You can report new bugs by creating a new issue either in [JIRA](https://jira.mongodb.org/projects/INTELLIJ/issues/) or
[GitHub](https://github.com/mongodb-js/intellij/issues). Please include as much information as possible about your
environment
and include any relevant logs.

## Starting the plugin locally
Expand Down Expand Up @@ -71,18 +74,19 @@ Will apply the latest changes to the running IDE.
UI tests require a working local environment, so before running them, please revisit the
`Getting Started` section.

Once the environment is set up, run the follow commandline script to run all the UI tests of
Once the environment is set up, run the follow commandline script to run all the UI tests of
the project:

```sh
./gradle/run-ui-test.sh
```

It will take a while, and Remote Robot will take ownership of your mouse once it starts
It will take a while, and Remote Robot will take ownership of your mouse once it starts
a running IntelliJ environment, so please take a seat and watch it run.

If a test fails, there will be a video recording in `packages/jetbrains-plugin/video` in AVI format
(you might need VLC Player to view it if you use a Mac) and also a screenshot in `packages/jetbrains-plugin/build/reports`
(you might need VLC Player to view it if you use a Mac) and also a screenshot
in `packages/jetbrains-plugin/build/reports`
alongside the hierarchy of the view (the "DOM").

## Running a single UI Test
Expand Down Expand Up @@ -115,15 +119,15 @@ add a new dependency:

## Releasing

We don't have an automatic cadence of releases. We plan new releases, implement the
We don't have an automatic cadence of releases. We plan new releases, implement the
features and then release when we are done. To release a new plugin version, is as follows:

* Go to [GitHub Actions](https://github.com/mongodb-js/intellij/actions) and run the `Release Draft` workflow.
* Choose the type of release that you want to publish, it can be either patch, minor and major. Following semver.
* Choose the type of release that you want to publish, it can be either patch, minor and major. Following semver.
* Wait until the workflow is done.
* It will validate that all the tests work and will publish a nightly version in the Marketplace.
* It will validate that all the tests work and will publish a nightly version in the Marketplace.
* Go to the [GitHub Releases](https://github.com/mongodb-js/intellij/releases) page and you'll find a new draft release.
* Publish the release as a normal GitHub Release, by editing it and publishing.
* This will run a workflow _[you can check in GHA](https://github.com/mongodb-js/intellij/actions)_.
* When done it will update the main branch with the updated changelog and plugin version.
* And also will publish the package to the JetBrains Marketplace.
* When done it will update the main branch with the updated changelog and plugin version.
* And also will publish the package to the JetBrains Marketplace.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# mongodb-jetbrains-plugin

[![Quality Check](https://github.com/mongodb-js/intellij/actions/workflows/quality-check.yaml/badge.svg)](https://github.com/mongodb-js/intellij/actions/workflows/quality-check.yaml)
![GitHub Release](https://img.shields.io/github/v/release/mongodb-js/intellij?sort=semver&display_name=release&logo=github)
![GitHub Release](https://img.shields.io/github/v/release/mongodb-js/intellij?sort=semver&display_name=release&logo=jetbrains)
Expand Down
18 changes: 13 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

group = "com.mongodb"
// This should be bumped when releasing a new version using the versionBump task:
// ./gradlew versionBump -Pmode={major,minor,patch}
version="0.0.1"
version = "0.0.1"

plugins {
alias(libs.plugins.versions)
Expand Down Expand Up @@ -38,7 +37,14 @@ subprojects {
val testImplementation by configurations
val compileOnly by configurations

configurations.named("runtimeClasspath").configure {
exclude("org.jetbrains.kotlin")
exclude("org.jetbrains.kotlinx")
}

compileOnly(rootProject.libs.kotlin.stdlib)
compileOnly(rootProject.libs.kotlin.coroutines.core)
compileOnly(rootProject.libs.kotlin.reflect)
testImplementation(rootProject.libs.testing.jupiter.engine)
testImplementation(rootProject.libs.testing.jupiter.vintage.engine)
testImplementation(rootProject.libs.testing.mockito.core)
Expand Down Expand Up @@ -70,9 +76,11 @@ subprojects {
isScanForTestClasses = true
}

jvmArgs(listOf(
"--add-opens=java.base/java.lang=ALL-UNNAMED"
))
jvmArgs(
listOf(
"--add-opens=java.base/java.lang=ALL-UNNAMED"
)
)
}

withType<JacocoReport> {
Expand Down
6 changes: 5 additions & 1 deletion gradle/diktat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
- name: TOO_MANY_PARAMETERS
enabled: true
configuration:
maxParameterListSize: '10'
maxParameterListSize: '10'
- name: FILE_NAME_INCORRECT
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add comments to the YAML about why we're adding new rules here? That might not be easy to figure out in the future based on the file contents alone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment for each rule explaining why it's disabled / enabled.

enabled: false
- name: LOCAL_VARIABLE_EARLY_DECLARATION
enabled: false
Loading
Loading