Skip to content

Build and verify. Publish plugin on workflow dispatch #279

Build and verify. Publish plugin on workflow dispatch

Build and verify. Publish plugin on workflow dispatch #279

Workflow file for this run

name: Build and verify. Publish plugin on workflow dispatch
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:
- name: Run Cimon (eBPF)
uses: cycodelabs/cimon-action@v0
with:
client-id: ${{ secrets.CIMON_CLIENT_ID }}
secret: ${{ secrets.CIMON_SECRET }}
allowed-hosts: >
cdn.azul.com
jb.gg
jcenter.bintray.com
plugins.gradle.org
teamcity.jetbrains.com
www.jetbrains.com
- name: Maximize Build Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
- name: Fetch Sources
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/[email protected]
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Setup Gradle
uses: gradle/[email protected]
with:
gradle-home-cache-cleanup: true
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
- name: Build plugin
run: ./gradlew buildPlugin
- 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
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*
- name: Publish Plugin
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: ./gradlew publishPlugin
# test:
# name: Test
# needs: [ build ]
# runs-on: ubuntu-latest
# steps:
# - name: Fetch Sources
# uses: actions/checkout@v4
#
# - name: Setup Java
# uses: actions/setup-java@v3
# with:
# distribution: zulu
# java-version: 17
#
# - name: Setup Gradle
# uses: gradle/[email protected]
# with:
# gradle-home-cache-cleanup: true
#
# - name: Run Tests
# run: ./gradlew check
#
# - name: Collect Tests Result
# if: ${{ failure() }}
# uses: actions/upload-artifact@v3
# with:
# name: tests-result
# path: ${{ github.workspace }}/build/reports/tests
# TODO(MarshalX): uncomment when repository will be public
# - name: Upload Code Coverage Report
# uses: codecov/codecov-action@v3
# with:
# files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
verify:
name: Verify plugin
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Run Cimon (eBPF)
uses: cycodelabs/cimon-action@v0
with:
client-id: ${{ secrets.CIMON_CLIENT_ID }}
secret: ${{ secrets.CIMON_SECRET }}
allowed-hosts: >
cache-redirector.jetbrains.com
cdn.azul.com
data.services.jetbrains.com
*.cloudfront.net
jb.gg
jcenter.bintray.com
packages.jetbrains.team
plugins.gradle.org
plugins.jetbrains.com
raw.githubusercontent.com
teamcity.jetbrains.com
- name: Maximize Build Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^llvm-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^llvm-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
sudo docker image prune --all --force || true
- name: Fetch Sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Setup Gradle
uses: gradle/[email protected]
with:
gradle-home-cache-cleanup: true
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3
with:
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier