From a227e0e905d069f39ec0c7f94eeaa8ddde3d544d Mon Sep 17 00:00:00 2001 From: "Dmitriy.Panov" Date: Wed, 13 Nov 2024 14:31:29 +0100 Subject: [PATCH] IJI-2196 GitHub workflow to build IntelliJ IDEA Community distributions for all supported OS (cherry picked from commit 30e80f202d89acc6b4846caeba2a166e2675d899) IJ-CR-149323 GitOrigin-RevId: 8e57a8a4356dc6a3ba65706006dc0600e25a759e --- .github/actions/build_ide/action.yml | 24 ++++++++ .github/actions/upload_ide/action.yml | 43 ++++++++++++++ .github/workflows/IntelliJ_IDEA.yml | 81 +++++++++++++++++++++++++++ Dockerfile | 8 +-- 4 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 .github/actions/build_ide/action.yml create mode 100644 .github/actions/upload_ide/action.yml create mode 100644 .github/workflows/IntelliJ_IDEA.yml diff --git a/.github/actions/build_ide/action.yml b/.github/actions/build_ide/action.yml new file mode 100644 index 000000000000..984210796331 --- /dev/null +++ b/.github/actions/build_ide/action.yml @@ -0,0 +1,24 @@ +inputs: + os: + description: 'linux, windows or mac' + required: true + extension: + description: 'tar.gz, exe or sit' + required: true +runs: + using: composite + steps: + - name: Checkout JetBrains/android + uses: actions/checkout@v4.2.2 + with: + repository: JetBrains/android + path: android + ref: ${{github.ref}} + - name: Build environment + shell: bash + # language=bash + run: docker build . --target build_env --tag build_env + - name: Build .${{inputs.extension}} + shell: bash + # language=bash + run: docker run --rm --user "$(id -u)" --volume ${PWD}:/community build_env -Dintellij.build.target.os=${{inputs.os}} \ No newline at end of file diff --git a/.github/actions/upload_ide/action.yml b/.github/actions/upload_ide/action.yml new file mode 100644 index 000000000000..c89d4b5af3ee --- /dev/null +++ b/.github/actions/upload_ide/action.yml @@ -0,0 +1,43 @@ +inputs: + os: + description: 'linux, windows or mac' + required: true + extension: + description: 'tar.gz, exe, sit or dmg' + required: true + artifacts_dir: + description: 'IDE artifacts output directory' + required: true +runs: + using: composite + steps: + - name: Generate checksums + shell: bash + # language=bash + run: | + function checksum() { + file="$1" + # The output is a line with checksum, + # a character indicating type ('*' for --binary, ' ' for --text), + # and the supplied file argument + if [ "$(uname)" == Darwin ]; then + shasum --algorithm 256 --binary "$file" + else + sha256sum --binary "$file" + fi > "$file.sha256" + } + cd "${{inputs.artifacts_dir}}" + for it in *.${{inputs.extension}}; do checksum "$it"; done + if ls *.${{inputs.extension}}.spdx.json; then + for it in *.${{inputs.extension}}.spdx.json; do checksum "$it"; done + fi + - name: Upload .${{inputs.extension}} + uses: actions/upload-artifact@v4.4.3 + with: + name: ${{inputs.os}}-${{inputs.extension}}-unsigned + if-no-files-found: 'error' + retention-days: 1 + path: | + ${{inputs.artifacts_dir}}/*.${{inputs.extension}} + ${{inputs.artifacts_dir}}/*.spdx.json + ${{inputs.artifacts_dir}}/*.sha256 \ No newline at end of file diff --git a/.github/workflows/IntelliJ_IDEA.yml b/.github/workflows/IntelliJ_IDEA.yml new file mode 100644 index 000000000000..ae1a47e41894 --- /dev/null +++ b/.github/workflows/IntelliJ_IDEA.yml @@ -0,0 +1,81 @@ +name: IntelliJ IDEA +on: + schedule: + # daily at 4AM for the master branch + - cron: '0 4 * * *' + push: + # for each release + tags: + - 'idea/*' +env: + artifacts_dir: 'out/idea-ce/artifacts' +jobs: + # a single job for all OSes cannot be used due to free disk space lack on runners + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + - uses: ./.github/actions/build_ide + with: + os: linux + extension: tar.gz + - uses: ./.github/actions/upload_ide + with: + os: linux + extension: tar.gz + artifacts_dir: ${{env.artifacts_dir}} + build-windows: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + - uses: ./.github/actions/build_ide + with: + os: windows + extension: exe + - uses: ./.github/actions/upload_ide + with: + os: windows + extension: exe + artifacts_dir: ${{env.artifacts_dir}} + build-macos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + - uses: ./.github/actions/build_ide + with: + os: mac + extension: sit + - uses: ./.github/actions/upload_ide + with: + os: mac + extension: sit + artifacts_dir: ${{env.artifacts_dir}} + - name: Upload .dmg build scripts + uses: actions/upload-artifact@v4.4.3 + with: + name: dmg-build-scripts + if-no-files-found: 'error' + path: ${{env.artifacts_dir}}/macos-dmg-build/ + build-dmg: + runs-on: macos-latest + needs: build-macos + steps: + - uses: actions/checkout@v4.2.2 + - name: Download .dmg build scripts + uses: actions/download-artifact@v4.1.8 + with: + name: dmg-build-scripts + - name: Download .sit + uses: actions/download-artifact@v4.1.8 + with: + name: mac-sit-unsigned + - name: Build .dmg + shell: bash + # language=bash + run: /bin/bash ./build.sh + - name: Upload .dmg + uses: ./.github/actions/upload_ide + with: + os: mac + extension: dmg + artifacts_dir: . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c9a74c5c2801..84ea8eff046d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,16 +17,16 @@ VOLUME /root/.m2 # Community sources root VOLUME /community WORKDIR /community -ENTRYPOINT ["/bin/sh", "-c"] -CMD ["./installers.cmd"] +ENTRYPOINT ["/bin/sh", "./installers.cmd"] FROM build_env AS build_env_with_docker -LABEL Description="Community Build Environment with Docker (required to build additional tools like Repair utility)" +LABEL Description="Community Build Environment with Docker (required to build Snapcraft distributions)" RUN apt-get update && \ apt-get install -y docker.io \ && rm -rf /var/lib/apt/lists/* COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/docker-buildx RUN docker buildx version -# Docker socket +# Docker daemon socket is expected to be mounted with --volume /var/run/docker.sock:/var/run/docker.sock +# and the container should be run as the root user to be able to connect to the socket VOLUME /var/run/docker.sock CMD ["docker system info && ./installers.cmd"]