|
| 1 | +name: Build and verify |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +env: |
| 8 | + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} |
| 9 | + |
| 10 | +# Cancel any current or previous job from the same PR |
| 11 | +concurrency: |
| 12 | + group: ${{ github.head_ref || github.run_id }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + # Prepare environment and build the plugin |
| 18 | + build: |
| 19 | + name: Build |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + version: ${{ steps.properties.outputs.version }} |
| 23 | + pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} |
| 24 | + steps: |
| 25 | + |
| 26 | + # Check out the current repository |
| 27 | + - name: Fetch Sources |
| 28 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 |
| 29 | + |
| 30 | + # Set up Java environment for the next steps |
| 31 | + - name: Setup Java |
| 32 | + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 |
| 33 | + with: |
| 34 | + distribution: temurin |
| 35 | + java-version: 23 |
| 36 | + |
| 37 | + # Setup Gradle |
| 38 | + - name: Setup Gradle |
| 39 | + uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 #v4.4.1 |
| 40 | + |
| 41 | + # Set environment variables |
| 42 | + - name: Export Properties |
| 43 | + id: properties |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + PROPERTIES="$(./gradlew :plugin:properties --console=plain -q)" |
| 47 | + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" |
| 48 | +
|
| 49 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 50 | + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT |
| 51 | +
|
| 52 | + # Build plugin |
| 53 | + - name: Build plugin |
| 54 | + run: ./gradlew buildPlugin |
| 55 | + |
| 56 | + # Prepare plugin archive content for creating artifact |
| 57 | + - name: Prepare Plugin Artifact |
| 58 | + id: artifact |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + cd ${{ github.workspace }}/plugin/build/distributions |
| 62 | + FILENAME=`ls *.zip` |
| 63 | + unzip "$FILENAME" -d content |
| 64 | +
|
| 65 | + echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT |
| 66 | +
|
| 67 | + # Store already-built plugin as an artifact for downloading |
| 68 | + - name: Upload artifact |
| 69 | + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 |
| 70 | + with: |
| 71 | + name: ${{ steps.artifact.outputs.filename }} |
| 72 | + path: ./intellij-plugin/build/distributions/content/*/* |
| 73 | + |
| 74 | + # Run tests and upload a code coverage report |
| 75 | + test: |
| 76 | + name: Test |
| 77 | + needs: [ build ] |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + |
| 81 | + # Check out the current repository |
| 82 | + - name: Fetch Sources |
| 83 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 |
| 84 | + |
| 85 | + # Set up Java environment for the next steps |
| 86 | + - name: Setup Java |
| 87 | + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 |
| 88 | + with: |
| 89 | + distribution: temurin |
| 90 | + java-version: 23 |
| 91 | + |
| 92 | + # Setup Gradle |
| 93 | + - name: Setup Gradle |
| 94 | + uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 #v4.4.1 |
| 95 | + |
| 96 | + # Run tests |
| 97 | + - name: Run Tests |
| 98 | + run: ./gradlew :plugin:check |
| 99 | + |
| 100 | + # Collect Tests Result of failed tests |
| 101 | + - name: Collect Tests Result |
| 102 | + if: ${{ failure() }} |
| 103 | + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 |
| 104 | + with: |
| 105 | + name: tests-result |
| 106 | + path: ${{ github.workspace }}/plugin/build/reports/tests |
| 107 | + |
| 108 | + # Run plugin structure verification along with IntelliJ Plugin Verifier |
| 109 | + verify: |
| 110 | + name: Verify plugin |
| 111 | + needs: [ build ] |
| 112 | + runs-on: ubuntu-latest |
| 113 | + steps: |
| 114 | + |
| 115 | + # Free GitHub Actions Environment Disk Space |
| 116 | + - name: Maximize Build Space |
| 117 | + uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be #v1.3.1 |
| 118 | + with: |
| 119 | + tool-cache: false |
| 120 | + android: false |
| 121 | + dotnet: true |
| 122 | + haskell: true |
| 123 | + large-packages: true |
| 124 | + docker-images: true |
| 125 | + swap-storage: true |
| 126 | + |
| 127 | + # Check out the current repository |
| 128 | + - name: Fetch Sources |
| 129 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 |
| 130 | + |
| 131 | + # Set up Java environment for the next steps |
| 132 | + - name: Setup Java |
| 133 | + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 |
| 134 | + with: |
| 135 | + distribution: temurin |
| 136 | + java-version: 23 |
| 137 | + |
| 138 | + # Setup Gradle |
| 139 | + - name: Setup Gradle |
| 140 | + uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 #v4.4.1 |
| 141 | + |
| 142 | + # Cache Plugin Verifier IDEs |
| 143 | + - name: Setup Plugin Verifier IDEs Cache |
| 144 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4.2.3 |
| 145 | + with: |
| 146 | + path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides |
| 147 | + key: plugin-verifier-${{ hashFiles('plugin/build/listProductsReleases.txt') }} |
| 148 | + |
| 149 | + # Run Verify Plugin task and IntelliJ Plugin Verifier tool |
| 150 | + - name: Run Plugin Verification tasks |
| 151 | + run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} |
| 152 | + |
| 153 | + # Collect Plugin Verifier Result |
| 154 | + - name: Collect Plugin Verifier Result |
| 155 | + if: ${{ always() }} |
| 156 | + uses: actions/upload-artifact@v4 |
| 157 | + with: |
| 158 | + name: pluginVerifier-result |
| 159 | + path: ${{ github.workspace }}/plugin/build/reports/pluginVerifier |
0 commit comments