Skip to content

Commit

Permalink
Replace Docker executor with Ubuntu VM to fix problems with memory (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelLipski authored Jan 6, 2025
1 parent 01681ec commit 53a2ceb
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 114 deletions.
46 changes: 35 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
version: 2.1

executors:
docker_executor:
# https://circleci.com/docs/using-docker/#x86
# https://circleci.com/pricing/
ubuntu_executor:
machine:
# https://circleci.com/developer/images?imageType=machine
image: ubuntu-2204:2024.01.1
resource_class: large
docker:
- image: 'gitmachete/intellij-plugin-ci:11.0.0'
working_directory: ~/git-machete-intellij-plugin

commands:
install_github_cli:
steps:
- run:
name: Install GitHub CLI
# language=sh
command: |
# Install the latest version of GitHub CLI
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
| sudo tee /etc/apt/sources.list.d/github-cli.list
sudo apt-get update
sudo apt-get install gh -y
restore_gradle_cache:
steps:
- restore_cache:
Expand Down Expand Up @@ -93,12 +106,22 @@ commands:
jobs:
build:
executor: docker_executor
executor: ubuntu_executor
steps:
- checkout
- install_github_cli
- run:
name: Install other dependencies for pre-build checks
# language=sh
command: |
sudo apt-get update
sudo apt-get install shellcheck -y
npm install --global remark-cli remark-lint-no-dead-urls remark-validate-links
remark --help
- run:
name: Run pre-build checks
command: ./scripts/run-pre-build-checks

- restore_gradle_cache
- run:
name: Start Gradle daemon
Expand Down Expand Up @@ -198,7 +221,7 @@ jobs:
key: gradle-deps-v12-{{ checksum "gradle/libs.versions.toml" }}-{{ .Branch }}

ui-tests-recent:
executor: docker_executor
executor: ubuntu_executor
steps:
- checkout
- restore_gradle_cache
Expand All @@ -211,7 +234,7 @@ jobs:
- collect_ui_test_artifacts

ui-tests-earlier:
executor: docker_executor
executor: ubuntu_executor
steps:
- run: echo # there always needs to be at least one step left once conditions are evaluated
- when:
Expand All @@ -227,7 +250,7 @@ jobs:
# Hence, to speed up the builds, we only run them for develop/master/hotfix/release branches and not on PRs.
# Also, we run on branches related to ide-probe or UI tests, as indicated by their name.
matches:
pattern: "^(develop|hotfix/.+|.*ide(-)?probe.*|master|release/.+|.*ui(-)?test.*)$"
pattern: "^(.+/ci-.+|develop|hotfix/.+|.*ide(-)?probe.*|master|release/.+|.*ui(-)?test.*)$"
value: << pipeline.git.branch >>
steps:
- checkout
Expand All @@ -238,7 +261,7 @@ jobs:
- collect_ui_test_artifacts

publish-plugin:
executor: docker_executor
executor: ubuntu_executor
steps:
- checkout
- restore_gradle_cache
Expand All @@ -247,6 +270,7 @@ jobs:
name: Publish plugin to Jetbrains Marketplace
command: ./gradlew publishPlugin
- reconfigure_origin_remote
- install_github_cli
- run:
name: Push git tag
# language=sh
Expand Down Expand Up @@ -278,7 +302,7 @@ jobs:
scripts/close-github-milestone "$milestone"
check-for-updates:
executor: docker_executor
executor: ubuntu_executor
steps:
- checkout
- run:
Expand Down
35 changes: 2 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,26 +179,10 @@ To regenerate the CLI outputs:
See [Robot plugin](https://github.com/JetBrains/intellij-ui-test-robot)
and [a preso on testing UI of IntelliJ Plugins](https://slides.com/plipski/intellij-plugin-ui-testing) for more details.

#### macOS
#### macOS and Xvfb mode

It is not possible to run `uiTest` Gradle task in display mode `Xvfb` on macOS systems directly via `./gradlew`.
You can run UI tests inside Docker container (based on `gitmachete/intellij-plugin-ci` image) or using a Linux virtual machine.
Sample configuration for launching docker container is shown below. Environment variables `UID` and `GID` placed into the container will be the user and group identifiers
of the files created inside it. In example below, current working directory navigates to top-level directory of the project. When starting the container we should care about setting
environment variable `IDEPROBE_PATHS_BASE` to the directory to which the user whose `UID` and `GID` was passed to the container has access to (e.g. user's home directory).
```shell
./gradlew --stop # to avoid conflicts on Gradle's internal lock files
docker run --rm -e UID=$(id -u) -e GID=$(id -g) \
--platform linux/amd64 \
-v "$PWD":/home/docker/git-machete-intellij-plugin \
-v ~/.gradle:/home/docker/.gradle \
-v ~/.pluginVerifier:/home/docker/.pluginVerifier \
-v /tmp/ide-probe/cache:/tmp/ide-probe/cache \
-w /home/docker/git-machete-intellij-plugin \
gitmachete/intellij-plugin-ci \
./gradlew -PvirtualDisplay uiTest
```

You can run UI tests using a Linux virtual machine.

## Generate and/or install snapshot build of the plugin

Expand Down Expand Up @@ -263,21 +247,6 @@ So far created UI conventions:
On the other hand, **context-menu** actions text names should be kept short (**no** `This`/`Selected`).


## Rebuild the CI base image

To push the rebuilt image, you need write access to [`gitmachete` organization on Docker Hub](https://hub.docker.com/orgs/gitmachete).
`Dockerfile` together with the necessary `entrypoint.sh` exists under `docker` folder in project root directory.
```shell
cd docker/
version=... # determine the image version using Semantic Versioning rules
docker build -t gitmachete/intellij-plugin-ci:$version -t gitmachete/intellij-plugin-ci:latest .
docker push gitmachete/intellij-plugin-ci:$version
docker push gitmachete/intellij-plugin-ci:latest
```

Then, update `executors.docker_executor.docker[0].image` in [.circleci/config.yml](.circleci/config.yml).


## Versioning

We follow [Semantic versioning](https://semver.org/) for the plugin releases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun Project.configureVersionFromGit() {
// More precisely, "soon-to-happen-in-this-pipeline release version" in case of master builds
version = prospectiveReleaseVersion
} else if (!file(".git").exists()) {
// To make sure it's safe for Docker image builds where .git folder is unavailable
// To make sure it's safe for runs where .git folder is unavailable
version = "$prospectiveReleaseVersion-SNAPSHOT"
} else {
val maybeSnapshot = if (ciBranch == "develop") "" else "-SNAPSHOT"
Expand Down
52 changes: 0 additions & 52 deletions docker/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions docker/entrypoint.sh

This file was deleted.

4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
kotlin.stdlib.default.dependency=false
org.gradle.caching=true
org.gradle.configureOnDemand=true
org.gradle.daemon=false
# More memory needed by daemon in UI tests; also, see https://github.com/gradle/gradle/issues/19750 for MaxMetaspaceSize
org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx3G
org.gradle.parallel=true
org.jetbrains.intellij.platform.buildFeature.selfUpdateCheck=false

0 comments on commit 53a2ceb

Please sign in to comment.