kcl-lang / intellij-kcl

IntelliJ IDEA KCL Extension
https://kcl-lang.io
11 stars 11 forks source link

The project needs a CD workflow to auto build & destribute releases. #4

Closed amyXia1994 closed 3 months ago

amyXia1994 commented 1 year ago

Feature Request

Is your feature request related to a problem? Please describe:

The release of the plugin is now done manually and that takes lots of effort and storage.

Describe the feature you'd like:

use a github workflow to automatically build and distribute plugins on each IntelliJ version after the main branch is tagged by a version tag.

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

aciTags: DOCKER

stages: # 定义了一条pipeline
  - 测试
  - 构建发布包

PMD:
  stage: 测试
  plugin: PMD
  pluginConfig:
    encoding: UTF-8 # 编码设置
    excludes: # 排除哪些项不统计PMD
      - "src/main/gen/**"
  checkRule: # 校验结果
    - pmd1 = 0 && pmd2 = 0

单元测试:
  stage: 测试
  aciTags: DOCKER # 指定使用哪些runner
  steps:
    - plugin: clone
    - plugin: shell
      inputs:
        image: reg.docker.alibaba-inc.com/kusion/idea-plugin-builder:gradle6.9.0-jdk8-idea2020.2 # 指定使用哪个image
        command:
          - |
            export PLUGIN_VERSION=0.0.1 && export JDK_VERSION=8 && export IDEA_PLATFORM_VERSION="2020.2" && ./gradlew test
            chmod +x ./Scripts/coverage.sh
            echo ${WORKSPACE}
            PROJECT_ROOT=${WORKSPACE} ./Scripts/coverage.sh
    - plugin: coverage-client-upload-compass
      inputs:
        filePath: build/reports/cobertura.xml
  publisher:
    archiveArtifacts: 'build/jacocoHtml/,build/test-results/test/TEST-*.xml'
    allowEmptyResults: true
    junit: 'build/test-results/test/TEST-*.xml'
    html:
      index: build/jacocoHtml/index.html  #(html的入口)
      displayName: 覆盖率报告  #(html链接的展示名称 默认是 链接名称)
  only:
    triggerType:
      - pullRequest
      - push
2020.2 build:
  stage: 构建发布包 # 本阶段执行两个步骤,一是执行项目源代码编译,二是进行镜像的构建
  plugin: ANT-BUILD # 选用ANT-BUILD插件来驱动镜像构建
  only:
    triggerType:
      - tagPush
  pluginConfig:
    image: reg.docker.alibaba-inc.com/kusion/idea-plugin-builder:gradle6.9.0-jdk8-idea2020.2
    script:
      - cd ${LINKB_WORKSPACE}
      - export PLUGIN_VERSION=${ACI_COMMIT_REF_NAME}
      - export JDK_VERSION=8
      - export IDEA_PLATFORM_VERSION="2020.2"
      - ./gradlew buildPlugin
      - ./Scripts/ossutil64 cp ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip oss://antsys-kusion-dev/KCL_IDE/IntelliJ-IDEA/2020-2/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip --endpoint=http://cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com --access-key-id=${ACI_VAR_kusion_oss_ak} --access-key-secret=${ACI_VAR_kusion_oss_sk}
    outputs: # 纳入构建物列表
      - name: "kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2020.2.zip"
        desc: "KCL IDEA Plugin for IDEA 2020.2"
        paths: [ "./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip" ]

2020.3 & 2021.1 & 2021.2 & 2021.3 & 2022.1:
  stage: 构建发布包
  plugin: ANT-BUILD
  only:
    triggerType:
      - tagPush
  pluginConfig:
    image: reg.docker.alibaba-inc.com/kusion/idea-plugin-builder:gradle6.9.0-jdk11-idea
    script:
      - cd ${LINKB_WORKSPACE}
      - export PLUGIN_VERSION=${ACI_COMMIT_REF_NAME}
      - export JDK_VERSION=11 && export IDEA_PLATFORM_VERSION="2020.3" && ./gradlew buildPlugin && mv ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2020.3.zip
      - export JDK_VERSION=11 && export IDEA_PLATFORM_VERSION="2021.1" && ./gradlew buildPlugin && mv ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.1.zip
      - export JDK_VERSION=11 && export IDEA_PLATFORM_VERSION="2021.2" && ./gradlew buildPlugin && mv ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.2.zip
      - export JDK_VERSION=11 && export IDEA_PLATFORM_VERSION="2021.3" && ./gradlew buildPlugin && mv ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.3.zip
      - export JDK_VERSION=11 && export IDEA_PLATFORM_VERSION="2022.1" && ./gradlew buildPlugin && mv ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2022.1.zip
      - ./Scripts/ossutil64 cp ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2020.3.zip oss://antsys-kusion-dev/KCL_IDE/IntelliJ-IDEA/2020-3/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip --endpoint=http://cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com --access-key-id=${ACI_VAR_kusion_oss_ak} --access-key-secret=${ACI_VAR_kusion_oss_sk}
      - ./Scripts/ossutil64 cp ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.1.zip oss://antsys-kusion-dev/KCL_IDE/IntelliJ-IDEA/2021-1/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip --endpoint=http://cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com --access-key-id=${ACI_VAR_kusion_oss_ak} --access-key-secret=${ACI_VAR_kusion_oss_sk}
      - ./Scripts/ossutil64 cp ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.2.zip oss://antsys-kusion-dev/KCL_IDE/IntelliJ-IDEA/2021-2/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip --endpoint=http://cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com --access-key-id=${ACI_VAR_kusion_oss_ak} --access-key-secret=${ACI_VAR_kusion_oss_sk}
      - ./Scripts/ossutil64 cp ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.3.zip oss://antsys-kusion-dev/KCL_IDE/IntelliJ-IDEA/2021-3/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip --endpoint=http://cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com --access-key-id=${ACI_VAR_kusion_oss_ak} --access-key-secret=${ACI_VAR_kusion_oss_sk}
      - ./Scripts/ossutil64 cp ./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2022.1.zip oss://antsys-kusion-dev/KCL_IDE/IntelliJ-IDEA/2022-1/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}.zip --endpoint=http://cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com --access-key-id=${ACI_VAR_kusion_oss_ak} --access-key-secret=${ACI_VAR_kusion_oss_sk}
    outputs: # 纳入构建物列表
      - name: "kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2020.3.zip"
        desc: "KCL IDEA Plugin for IDEA 2020.3"
        paths: [ "./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2020.3.zip" ]
      - name: "kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.1.zip"
        desc: "KCL IDEA Plugin for IDEA 2021.1"
        paths: [ "./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.1.zip" ]
      - name: "kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.2.zip"
        desc: "KCL IDEA Plugin for IDEA 2021.2"
        paths: [ "./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.2.zip" ]
      - name: "kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.3.zip"
        desc: "KCL IDEA Plugin for IDEA 2021.3"
        paths: [ "./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2021.3.zip" ]
      - name: "kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2022.1.zip"
        desc: "KCL IDEA Plugin for IDEA 2022.1"
        paths: [ "./build/distributions/kcl-idea-plugin-${ACI_COMMIT_REF_NAME}-2022.1.zip" ]

notifications:
  dingding监听消息:
    type: DINGTALK
    level: PIPELINE
    when: ALWAYS
    channels:
      - https://oapi.dingtalk.com/robot/send?access_token=5d2b5c42f363ff9f6bc008fc25d6b54c0a3e1fd828c535d0a2553bc9f6362034
He1pa commented 3 months ago

https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#publishing-plugin-with-gradle