forked from OpenLiberty/liberty-tools-intellij
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (166 loc) · 6.16 KB
/
build.yaml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Build
on:
workflow_call:
inputs:
refLsp4ij:
description: 'Reference/branch for Lsp4ij checkout'
type: string
required: true
default: main
lsp4ijBranch:
description: 'PR number or branch name for Artifact upload'
type: string
required: true
useLocalPlugin:
description: 'Use lsp4ij locally'
required: true
type: boolean
default: false
refLTITag:
description: 'Reference LTI Tag/Branch'
type: string
required: true
default: main
workflow_dispatch:
inputs:
useLocalPlugin:
description: 'Use lsp4ij locally'
required: true
type: boolean
default: false
lsp4ijPrNumber:
description: 'Run build with an LSP4IJ PR. Make sure to enter the LSP4IJ PR number in the "Reference/branch/PR for LSP4IJ checkout" input box.'
required: true
type: boolean
default: false
refLsp4ij:
description: 'Reference/branch/PR for LSP4IJ checkout'
type: string
required: true
default: main
refLTITag:
description: 'Reference LTI Tag/Branch'
type: string
required: false
default: main
push:
branches: '**'
pull_request:
branches: [ main ]
jobs:
fetch_merge_commit_sha_from_lsp4ij_PR:
runs-on: ubuntu-latest
outputs:
pr_details: ${{ steps.extract.outputs.pr_details }}
checkout_name: ${{ steps.extract.outputs.checkout_name }}
env:
API_URL: https://api.github.com/repos/redhat-developer/lsp4ij/pulls
REF_LSP4IJ: ${{ inputs.refLsp4ij }}
LSP4IJ_BRANCH: ${{ inputs.lsp4ijBranch }}
name: Fetch Commit ${{ inputs.refLsp4ij || '' }}
steps:
- name: Extract Merge Commit SHA
shell: bash
id: extract
run: |
pr_details="${{ env.REF_LSP4IJ }}"
checkout_name="${{ env.LSP4IJ_BRANCH }}"
if [ "${{ inputs.lsp4ijPrNumber }}" == "true" ]; then
url="${{ env.API_URL }}/${{ env.REF_LSP4IJ }}"
pr_detail=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$url")
pr_details=$(jq -r '.merge_commit_sha' <<< "$pr_detail" | xargs)
echo "Merge commit SHA of PR ${{ env.REF_LSP4IJ }}: $pr_details"
checkout_name="${{ env.REF_LSP4IJ }}"
if [[ "$pr_details" == "null" ]]; then
echo "::warning file=::The merge commit SHA of the entered PR is 'null'. Please try again later or use a different PR number."
fi
elif [ -z "$pr_details" ]; then
echo "No LSP4IJ checkout found. Using default case."
elif [ -z "$checkout_name" ]; then
echo "Merge Commit SHA/Branch Name/Tag : $pr_details"
checkout_name="${{ env.REF_LSP4IJ }}"
else
echo "Merge Commit SHA/Branch Name/Tag : $pr_details"
fi
# Set output for further steps
echo "pr_details=$pr_details" >> $GITHUB_OUTPUT
echo "checkout_name=$checkout_name" >> $GITHUB_OUTPUT
build:
needs: fetch_merge_commit_sha_from_lsp4ij_PR
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
runtime: [ linux, mac, windows ]
include:
- runtime: linux
os: ubuntu-latest
reportName: linux-test-report
- runtime: mac
os: macOS-latest
reportName: mac-test-report
- runtime: windows
os: windows-latest
reportName: windows-test-report
env:
USE_LOCAL_PLUGIN: ${{ inputs.useLocalPlugin || false }}
REF_LSP4IJ: ${{ needs.fetch_merge_commit_sha_from_lsp4ij_PR.outputs.pr_details }}
LSP4IJ_BRANCH: ${{ needs.fetch_merge_commit_sha_from_lsp4ij_PR.outputs.checkout_name }}
REF_LTI_TAG: ${{ inputs.refLTITag }}
steps:
- name: Configure pagefile
if: contains(matrix.os, 'windows')
uses: al-cheb/[email protected]
with:
minimum-size: 8GB
maximum-size: 10GB
disk-root: "C:"
- name: 'Checkout liberty-tools-intellij'
uses: actions/checkout@v4
with:
path: liberty-tools-intellij
ref: ${{ env.REF_LTI_TAG }}
- name: 'Install required integration test software'
working-directory: ./liberty-tools-intellij
run: bash ./src/test/resources/ci/scripts/setup.sh
# Checkout and build lsp4ij only if USE_LOCAL_PLUGIN is true
- name: 'Checkout lsp4ij'
if: ${{ inputs.useLocalPlugin == true }}
uses: actions/checkout@v4
with:
repository: redhat-developer/lsp4ij
path: lsp4ij
ref: ${{ env.REF_LSP4IJ }}
- name: 'Build Lsp4ij'
if: ${{ inputs.useLocalPlugin == true }}
working-directory: ./lsp4ij
run: bash ./gradlew buildPlugin
- name: 'Unzip lsp4ij file'
if: ${{ inputs.useLocalPlugin == true }}
working-directory: ./lsp4ij/build/distributions
run: |
unzip -o '*.zip' -d .
- name: 'Build Liberty-Tools-Intellij'
working-directory: ./liberty-tools-intellij
run: bash ./gradlew buildPlugin -PuseLocal=${{ env.USE_LOCAL_PLUGIN }}
- name: 'Archive artifacts'
if: ${{ runner.os == 'Linux' && !failure() }}
uses: actions/[email protected]
with:
name: liberty-tools-intellij-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH || 'default' }}
path: |
./**/*liberty-tools-intellij*.zip
./**/libs/*liberty-tools-intellij*.jar
if-no-files-found: warn
retention-days: 7
- name: 'Run UI integration tests'
id: run_tests
working-directory: ./liberty-tools-intellij
run: bash ./src/test/resources/ci/scripts/run.sh
- name: 'Archive Test logs and reports'
if: ${{ failure() && steps.run_tests.conclusion == 'failure' }}
uses: actions/[email protected]
with:
name: ${{ matrix.reportName }}-LTI-${{ env.REF_LTI_TAG || 'default' }}-LSP4IJ-${{ env.LSP4IJ_BRANCH || 'default' }}
path: |
liberty-tools-intellij/build/reports/