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
This commit is contained in:
Dmitriy.Panov
2024-11-13 14:31:29 +01:00
committed by intellij-monorepo-bot
parent 106f8d8d51
commit a227e0e905
4 changed files with 152 additions and 4 deletions

24
.github/actions/build_ide/action.yml vendored Normal file
View File

@@ -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}}

43
.github/actions/upload_ide/action.yml vendored Normal file
View File

@@ -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

81
.github/workflows/IntelliJ_IDEA.yml vendored Normal file
View File

@@ -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: .

View File

@@ -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"]