-
Notifications
You must be signed in to change notification settings - Fork 889
105 lines (96 loc) · 3.27 KB
/
code-samples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Code Samples
on:
push:
branches: [ main ]
paths: [ 'code_samples/**','.github/workflows/code-samples.yml' ]
pull_request:
paths: [ 'code_samples/**','.github/workflows/code-samples.yml' ]
env:
PLUGIN_VERIFIER_IDE_VERSIONS: '2023.2.6 2023.3.6 2024.1.2'
jobs:
gradleValidation:
name: Gradle Wrappers
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
samples:
name: Code Samples / ${{ matrix.plugin }}
needs: gradleValidation
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plugin:
- action_basics
- comparing_string_references_inspection
- conditional_operator_intention
- editor_basics
- facet_basics
- framework_basics
- kotlin_demo
- live_templates
- max_opened_projects
- module
- project_model
- project_view_pane
- project_wizard
- psi_demo
- run_configuration
- simple_language_plugin
- tool_window
- tree_structure_provider
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Verify Plugin
run: (cd code_samples/${{ matrix.plugin }}; ./gradlew verifyPlugin)
- name: Test Plugin
run: (cd code_samples/${{ matrix.plugin }}; ./gradlew test)
- name: Export Properties
id: properties
shell: bash
run: |
echo "ideVersions=${PLUGIN_VERIFIER_IDE_VERSIONS// /-}" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
- name: Run Plugin Verifier
run: |
echo "
tasks {
runPluginVerifier {
ideVersions.set("\"$PLUGIN_VERIFIER_IDE_VERSIONS\"".split(' ').toList())
}
}
" >> code_samples/${{ matrix.plugin }}/build.gradle.kts
cd code_samples/${{ matrix.plugin }}
./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.plugin }}-pluginVerifier-result
path: ${{ github.workspace }}/code_samples/${{ matrix.plugin }}/build/reports/pluginVerifier
mirror:
name: Code Samples Mirror
if: github.ref == 'refs/heads/main' && github.repository == 'JetBrains/intellij-sdk-docs'
needs: samples
runs-on: ubuntu-latest
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Prepare Mirror
run: |
git clone --bare [email protected]:JetBrains/intellij-sdk-docs.git .
git branch | grep -v "main" | xargs -r git branch -D
git filter-branch --prune-empty --subdirectory-filter code_samples main
git push --mirror [email protected]:JetBrains/intellij-sdk-code-samples.git