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: CI/CD and basic infrastructure for the IntelliJ Plugin #1

Merged
merged 65 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
529ef6f
chore: merge with main
kmruiz May 7, 2024
9c2d397
chore: sample benchmark
kmruiz May 4, 2024
6e6ea45
chore: support changelog management
kmruiz May 4, 2024
ecb0fde
chore: remove unused code
kmruiz May 4, 2024
f6900c7
chore: fix pre-commit
kmruiz May 4, 2024
b5f5bea
chore: work on the ci/cd flow
kmruiz May 4, 2024
5d8671d
chore: fix test name
kmruiz May 6, 2024
6dc78b0
chore: ensure type is identify
kmruiz May 6, 2024
d1967bf
chore: don't use meets as it's from the intellij lib
kmruiz May 6, 2024
671f8af
chore: logMessage test
kmruiz May 6, 2024
c24fb37
chore: cleanup and add new field
kmruiz May 6, 2024
cca3183
chore: fix dependency injection
kmruiz May 6, 2024
d8b2205
chore: clean up observability
kmruiz May 7, 2024
db6a76b
chore: fix pipeline syntax
kmruiz May 7, 2024
b763f28
chore: fix sbom generation
kmruiz May 7, 2024
af1aeda
chore: fix integration with testing framework
kmruiz May 7, 2024
c77c801
chore: fix integration with testing framework
kmruiz May 7, 2024
843ff6e
chore: allow test report to write a check
kmruiz May 7, 2024
73fc7bd
chore: fix test run
kmruiz May 7, 2024
d3d02bc
chore: only push test report once
kmruiz May 7, 2024
98487a2
chore: show test results even if they fail
kmruiz May 7, 2024
f64b6d0
chore: setup jacoco test report
kmruiz May 7, 2024
76629b4
chore: checkout code so we can annotate it
kmruiz May 7, 2024
b1755a8
chore: working on test coverage
kmruiz May 7, 2024
db35741
chore: add id-token permissions to update comments
kmruiz May 7, 2024
5fddeae
chore: coverage debug
kmruiz May 7, 2024
aa60a2d
chore: download coverage reports
kmruiz May 7, 2024
4165f2b
chore: coverage report
kmruiz May 7, 2024
6c14981
chore: fix coverage config
kmruiz May 7, 2024
b813b19
chore: add jmh results to pr
kmruiz May 7, 2024
ad2e967
chore: reserve disk space for the verify plugin task
kmruiz May 7, 2024
b826645
chore: fix jmh config
kmruiz May 7, 2024
5193eb0
chore: separate unit test from functional test
kmruiz May 7, 2024
0efa981
chore: try to fix issue with disk space
kmruiz May 8, 2024
ceec954
chore: upload sbom as an artifact
kmruiz May 8, 2024
48c9541
chore: working on releasing
kmruiz May 8, 2024
7930ab8
chore: working on release
kmruiz May 8, 2024
dec859e
chore: set up user and email
kmruiz May 8, 2024
7d3313f
chore: fix tag
kmruiz May 8, 2024
230ce15
chore: add permissions to write
kmruiz May 8, 2024
be0cdb5
chore: build plugin
kmruiz May 8, 2024
dbc1453
chore: test git ref
kmruiz May 8, 2024
6f55d4a
chore: test chagelog
kmruiz May 8, 2024
0991d13
chore: do not check out twice
kmruiz May 8, 2024
cbe426d
chore: documentation
kmruiz May 8, 2024
581985e
chore: only wait for relevant tasks
kmruiz May 8, 2024
94e44c2
chore: release plugin changes
kmruiz May 8, 2024
bdc2fb8
chore: the changelog should be changed or the no release notes label …
kmruiz May 8, 2024
a1a37d6
chore: remember to checkout code
kmruiz May 8, 2024
0d68e29
chore: clean up docs
kmruiz May 8, 2024
6eae6c8
chore: start working on guidelines
kmruiz May 8, 2024
478dd4d
chore: add relevant badges
kmruiz May 8, 2024
11c1173
chore: add a lenient failure threshold to jmh benchmarks
kmruiz May 8, 2024
fa25603
chore: add codeql support
kmruiz May 8, 2024
a7c8d83
chore: fix plugin.xml
kmruiz May 8, 2024
e972c55
chore: fix releases
kmruiz May 8, 2024
26f9ee5
chore: example changelog line
kmruiz May 8, 2024
60dff3e
chore: test draft release
kmruiz May 8, 2024
154d910
chore: clean up
kmruiz May 8, 2024
4c64501
chore: also push the changes to main on release
kmruiz May 8, 2024
4ecfb41
chore: propagate build information via properties
kmruiz May 8, 2024
8c9a864
chore: force non nullable in BuildInformation
kmruiz May 8, 2024
74687f0
chore: support for publishing in different channels
kmruiz May 9, 2024
466b1d7
chore: do not fail, just send to eap
kmruiz May 9, 2024
e1cdf04
chore: disable codeql
kmruiz May 9, 2024
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
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
^^^^^
Please fill the title above according to https://www.conventionalcommits.org/en/v1.0.0/.

type(scope): message <TICKET-NUMBER-IF-ANY>

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? -->
43 changes: 43 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "CodeQL"

on:
push:
branches: [ "main", '*-releases' ]
tags: [ 'v*' ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '30 14 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-extended

- name: Auto Build
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
119 changes: 119 additions & 0 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Draft release

on:
workflow_dispatch:
inputs:
versionBump:
description: 'Version bump'
type: choice
required: true
default: 'patch'
options:
- patch
- minor
- major
- exact-version

exactVersion:
description: 'Exact version: (Only effective selecting "exact-version" as version bump)'
required: false

permissions:
contents: write

jobs:
prepare-release:
name: "Prepare Release"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
cache: 'gradle'
- name: Determine Next Version
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e

VERSION_BUMP=${{ github.event.inputs.versionBump }}

if [[ "$VERSION_BUMP" == "major" || "$VERSION_BUMP" == "minor" || "$VERSION_BUMP" == "patch" ]]; then
./gradlew --quiet --console=plain versionBump -Pmode="$VERSION_BUMP"
else
./gradlew --quiet --console=plain versionBump -PexactVersion="${{ github.event.inputs.exactVersion }}"
fi

NEXT_VERSION=$(./gradlew --quiet --console=plain getVersion)
echo "RELEASE_TAG=v${NEXT_VERSION}" >> "$GITHUB_ENV"

- name: Validate release tag
shell: bash
run: |
if [ -z "${RELEASE_TAG}" ]; then
echo "RELEASE_TAG is not set or is empty"
exit 1
fi

if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then
echo "Error: Tag $RELEASE_TAG already existing"
echo "If you are trying to re-create a draft release with this version, please delete the release and the tag first."
echo "If this version has already been release consider using a different one."
exit 1
fi

- name: Run All Tests
run: |
./gradlew "unitTest" ":packages:jetbrains-plugin:test"

- name: Patch Plugin XML
run: |
./gradlew ":packages:jetbrains-plugin:patchPluginXml"

- name: Verify Plugin
run: |
./gradlew ":packages:jetbrains-plugin:verifyPlugin"

- name: Patch Changelog
run: |
./gradlew ":packages:jetbrains-plugin:patchChangelog"

- name: Build Plugin
run: |
./gradlew ":packages:jetbrains-plugin:buildPlugin"

- name: Create Draft Release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.SVC_DEVTOOLSBOT_TOKEN }}
run: |
set -e
echo Creating draft release for: "${RELEASE_TAG}"

git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

git add .
git commit --no-verify -m "Release ${RELEASE_TAG}"
git tag ${RELEASE_TAG}
git push origin ${RELEASE_TAG}

GIT_REF=$(git rev-parse ${RELEASE_TAG})
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}" \
--target "${GIT_REF}" \
--draft \
packages/jetbrains-plugin/build/distributions/jetbrains-plugin.zip

36 changes: 36 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Release

on:
release:
types: [published]

jobs:
prepare-release:
name: "Prepare Release"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
cache: 'gradle'

- name: Publish into JetBrains Marketplace
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.SVC_DEVTOOLSBOT_TOKEN }}
run: |
set -e

git checkout main
git merge ${{ github.ref_name }}
git push origin main

# Do Release

Loading
Loading