-
Notifications
You must be signed in to change notification settings - Fork 1
Implement CI pipeline #11
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a501927
build: support for changelog
fioan89 8e23671
chore: update .gitignore
fioan89 5d80bde
build: github workflow to build, run tests and publish release draft
fioan89 2763084
fix: name of gradle task to zip the plugin
fioan89 2b5708f
fix: plugin artefacts should go in a folder without version
fioan89 7cfd5af
impl: workflow actions for release
fioan89 b94bee6
impl: initial version for dependabot
fioan89 439750d
fix: skip some of the dependencies from automatic upgrade
fioan89 c9f3bce
fix: include compile dependencies when building the zip
fioan89 ed8a82a
fix: use $GITHUB_OUTPUT to set step parameters
fioan89 a0d5959
fix: use github workflow context properties
fioan89 376bdf5
fix: use modern bash command substitution
fioan89 9f9ac77
fix: ensure changelog multiline output doesn't break
fioan89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Dependabot configuration: | ||
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Maintain dependencies for Gradle dependencies | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
target-branch: "main" | ||
schedule: | ||
interval: "weekly" | ||
time: "06:00" | ||
timezone: "America/Chicago" | ||
ignore: | ||
# these depend on the toolbox API and should be updated manually | ||
- dependency-name: "org.jetbrains.kotlin.jvm" | ||
- dependency-name: "org.jetbrains.kotlin.plugin.serialization" | ||
- dependency-name: "com.google.devtools.ksp" | ||
# these can have breaking changes | ||
- dependency-name: "com.jetbrains.toolbox:core-api" | ||
- dependency-name: "com.jetbrains.toolbox:ui-api" | ||
- dependency-name: "com.jetbrains.toolbox:remote-dev-api" | ||
commit-message: | ||
prefix: "chore" | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
target-branch: "main" | ||
schedule: | ||
interval: "weekly" | ||
time: "06:00" | ||
timezone: "America/Chicago" | ||
commit-message: | ||
prefix: "chore" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# GitHub Actions workflow for testing and preparing the plugin release. | ||
# GitHub Actions reference: https://help.github.com/en/actions | ||
|
||
name: Coder Toolbox Plugin Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
# Run plugin tests on every supported platform. | ||
test: | ||
strategy: | ||
matrix: | ||
platform: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4.2.2 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 21 | ||
cache: gradle | ||
|
||
- uses: gradle/wrapper-validation-action@v3.5.0 | ||
|
||
# Run tests | ||
- run: ./gradlew test --info | ||
|
||
# Collect Tests Result of failed tests | ||
- if: ${{ failure() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tests-result | ||
path: ${{ github.workspace }}/build/reports/tests | ||
|
||
build: | ||
name: Build | ||
needs: test | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.properties.outputs.version }} | ||
changelog: ${{ steps.properties.outputs.changelog }} | ||
steps: | ||
# Check out current repository | ||
- name: Fetch Sources | ||
uses: actions/checkout@v4.2.2 | ||
|
||
# Setup Java 21 environment for the next steps | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 21 | ||
cache: gradle | ||
|
||
# Set environment variables | ||
- name: Export Properties | ||
id: properties | ||
shell: bash | ||
run: | | ||
PROPERTIES="$(./gradlew properties --console=plain -q)" | ||
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | ||
NAME="$(echo "$PROPERTIES" | grep "^group:" | cut -f2- -d ' ')" | ||
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" | ||
CHANGELOG="${CHANGELOG//'%'/'%25'}" | ||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" | ||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
echo "name=$NAME" >> $GITHUB_OUTPUT | ||
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT | ||
|
||
# Run plugin build | ||
- name: Run Build | ||
run: ./gradlew clean pluginZip --info | ||
|
||
# Prepare plugin archive content for creating artifact | ||
- name: Prepare Plugin Artifact | ||
id: artifact | ||
shell: bash | ||
run: | | ||
cd ${{ github.workspace }}/build/distributions | ||
FILENAME=$(ls *.zip) | ||
unzip "$FILENAME" -d content | ||
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT | ||
|
||
# Store already-built plugin as an artifact for downloading | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.artifact.outputs.filename }} | ||
path: ./build/distributions/content/*/* | ||
|
||
# Prepare a draft release for GitHub Releases page for the manual verification | ||
# If accepted and published, release workflow would be triggered | ||
releaseDraft: | ||
name: Release Draft | ||
if: github.event_name != 'pull_request' | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Check out current repository | ||
- name: Fetch Sources | ||
uses: actions/checkout@v4.2.2 | ||
|
||
# Remove old release drafts by using GitHub CLI | ||
- name: Remove Old Release Drafts | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh api repos/${{ github.repository }}/releases \ | ||
--jq '.[] | select(.draft == true) | .id' \ | ||
| xargs -I '{}' gh api -X DELETE repos/${{ github.repository }}/releases/{} | ||
|
||
# Create new release draft - which is not publicly visible and requires manual acceptance | ||
- name: Create Release Draft | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo "${{ needs.build.outputs.changelog }}" > RELEASE_NOTES.md | ||
gh release create v${{ needs.build.outputs.version }} \ | ||
--draft \ | ||
--target ${GITHUB_REF_NAME} \ | ||
--title "v${{ needs.build.outputs.version }}" \ | ||
--notes-file RELEASE_NOTES.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow. | ||
|
||
name: Release | ||
on: | ||
release: | ||
types: [ prereleased, released ] | ||
|
||
jobs: | ||
|
||
# Prepare and publish the plugin to the Marketplace repository | ||
release: | ||
name: Publish Plugin | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Check out current repository | ||
- name: Fetch Sources | ||
uses: actions/checkout@v4.2.2 | ||
with: | ||
ref: ${{ github.event.release.tag_name }} | ||
|
||
# Setup Java 21 environment for the next steps | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 21 | ||
cache: gradle | ||
|
||
# Set environment variables | ||
- name: Export Properties | ||
id: properties | ||
shell: bash | ||
run: | | ||
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' | ||
${{ github.event.release.body }} | ||
EOM | ||
)" | ||
|
||
CHANGELOG="${CHANGELOG//'%'/'%25'}" | ||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" | ||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" | ||
|
||
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT | ||
|
||
# Update Unreleased section with the current release note | ||
- name: Patch Changelog | ||
if: ${{ steps.properties.outputs.changelog != '' }} | ||
env: | ||
CHANGELOG: ${{ steps.properties.outputs.changelog }} | ||
run: | | ||
./gradlew patchChangelog --release-note="$CHANGELOG" | ||
|
||
# Publish the plugin to the Marketplace | ||
# TODO - enable this step (by removing the `if` block) when JetBrains is clear about release procedures | ||
- name: Publish Plugin | ||
if: false | ||
env: | ||
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | ||
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} | ||
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | ||
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} | ||
run: ./gradlew publishPlugin --info | ||
|
||
# Upload artifact as a release asset | ||
- name: Upload Release Asset | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* | ||
|
||
# Create pull request | ||
- name: Create Pull Request | ||
if: ${{ steps.properties.outputs.changelog != '' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
VERSION="${{ github.event.release.tag_name }}" | ||
BRANCH="changelog-update-$VERSION" | ||
|
||
git config user.email "action@github.com" | ||
git config user.name "GitHub Action" | ||
|
||
git checkout -b $BRANCH | ||
git commit -am "Changelog update - $VERSION" | ||
git push --set-upstream origin $BRANCH | ||
|
||
gh pr create \ | ||
--title "Changelog update - \`$VERSION\`" \ | ||
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ | ||
--base main \ | ||
--head $BRANCH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,7 @@ build | |
jvm/ | ||
|
||
# IntelliJ IDEA | ||
.idea | ||
.idea | ||
|
||
# hidden macOS metadata files | ||
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Coder Toolbox Plugin Changelog | ||
|
||
## Unreleased | ||
|
||
### Added | ||
|
||
- initial support for JetBrains Toolbox 2.6.0.38311 with the possibility to manage the workspaces - i.e. start, stop, | ||
update and delete actions and also quick shortcuts to templates, web terminal and dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version=0.1.0 | ||
group=com.coder.toolbox | ||
name=coder-toolbox |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we detect the breaking changes via some tests in the PRs. I would prefer an auto update over a manual one if we can detect the breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of the breaking changes (like for example breaking changes in the Toolbox api) can be detected at compile time. Basically the CI pipeline will fail and we can't merge the upgrade. However, the kotlin dependencies will be harder to detect, the compile can work fine but at runtime things might break because of the changes in the kotlin stdlib (just an example) shipped with Toolbox. We would need some end to end tests to detect these kind of changes. :(