-
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
Changes from 8 commits
a501927
8e23671
5d80bde
2763084
2b5708f
7cfd5af
b94bee6
439750d
c9f3bce
ed8a82a
a0d5959
376bdf5
9f9ac77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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" |
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/[email protected] | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 21 | ||
cache: gradle | ||
|
||
- uses: gradle/[email protected] | ||
|
||
# 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/[email protected] | ||
|
||
# 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 "::set-output name=version::$VERSION" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GitHub now recommends writing to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I will fix this everywhere. |
||
echo "::set-output name=name::$NAME" | ||
echo "::set-output name=changelog::$CHANGELOG" | ||
|
||
# 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 "::set-output name=filename::${FILENAME:0:-4}" | ||
# 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/[email protected] | ||
|
||
# Remove old release drafts by using the curl request for the available releases with draft flag | ||
- name: Remove Old Release Drafts | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh api repos/{owner}/{repo}/releases \ | ||
--jq '.[] | select(.draft == true) | .id' \ | ||
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/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: | | ||
gh release create v${{ needs.build.outputs.version }} \ | ||
--draft \ | ||
--target ${GITHUB_REF_NAME} \ | ||
--title "v${{ needs.build.outputs.version }}" \ | ||
--notes "$(cat << 'EOM' | ||
${{ needs.build.outputs.changelog }} | ||
EOM | ||
)" |
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/[email protected] | ||
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 "::set-output name=changelog::$CHANGELOG" | ||
|
||
# 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 "[email protected]" | ||
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 |
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 |
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. |
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 |
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. :(