-
Notifications
You must be signed in to change notification settings - Fork 10
144 lines (117 loc) · 6.54 KB
/
Testing-Conversion.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
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
name: Test Conversion
on:
pull_request:
types:
- labeled
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
# Any prerequisite steps
- uses: actions/checkout@master
- id: set-matrix
run: |
TASKS=$(echo $(cat $GITHUB_WORKSPACE/.github/workflows/guides.json))
TASKS="${TASKS//'%'/'%25'}"
TASKS="${TASKS//$'\n'/'%0A'}"
TASKS="${TASKS//$'\r'/'%0D'}"
echo "::set-output name=matrix::$TASKS"
testingConversion:
runs-on: ubuntu-latest
if: github.event.label.name == 'RunTests'
steps:
- uses: actions/checkout@master
- name: Checkout Guide Converter repo
uses: actions/checkout@v2
with:
repository: OpenLiberty/cloud-hosted-guide-converter
path: GuideConverter
- name: Checkout instructions
uses: actions/checkout@v2
with:
repository: OpenLiberty/cloud-hosted-guides
path: GuideConverter/cloud-hosted-guides
ref: ${{ github.event.pull_request.branch }}
- uses: actions/setup-java@v1
with:
java-version: '16' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Get Guide name
run: |
echo ${{ github.event.pull_request.body }}
prText="${{ github.event.pull_request.body }}"
removeStart="${prText:44}"
removeEnd="${removeStart% *}"
instructionsMD=`echo "cloud_hosted_${removeEnd}" | sed -e 's/-/_/g'`
echo $removeEnd
echo $instructionsMD
cd GuideConverter
if [ -f "cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/instructions.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/instructions"; elif [ -f "cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/${instructionsMD}.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/${instructionsMD}"; elif [ -f "cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/instructions.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/instructions"; else mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/cloud-hosted-$removeEnd"; fi
testingDevConversion:
runs-on: ubuntu-latest
if: github.event.label.name == 'RunTestsDev'
steps:
- uses: actions/checkout@master
- name: Checkout Guide Converter repo
uses: actions/checkout@v2
with:
repository: OpenLiberty/cloud-hosted-guide-converter
path: GuideConverter
- name: Checkout instructions
uses: actions/checkout@v2
with:
repository: OpenLiberty/cloud-hosted-guides
path: GuideConverter/cloud-hosted-guides
ref: ${{ github.event.pull_request.branch }}
- uses: actions/setup-java@v1
with:
java-version: '16' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Get Guide name
run: |
echo ${{ github.event.pull_request.body }}
prText="${{ github.event.pull_request.body }}"
removeStart="${prText:44}"
removeEnd="${removeStart% *}"
removeEnd=`echo "${removeEnd}" | sed -e 's/ repo for//g'`
removeEnd=`echo "${removeEnd}" | sed -e 's/cloud-hosted-//g'`
instructionsMD=`echo "cloud_hosted_${removeEnd}" | sed -e 's/-/_/g'`
echo $removeEnd
echo $instructionsMD
cd GuideConverter
if [ -f "cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/instructions.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/instructions"; elif [ -f "cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/${instructionsMD}" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/${instructionsMD}"; else mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-$removeEnd/labs/instructions"; fi
testingConversionAllGuides:
needs: matrix
runs-on: ubuntu-latest
strategy:
matrix:
guides: ${{fromJson(needs.matrix.outputs.matrix)}}
if: github.event.label.name == 'TestAll'
steps:
- uses: actions/checkout@master
- name: Checkout Guide Converter repo
uses: actions/checkout@v2
with:
repository: OpenLiberty/cloud-hosted-guide-converter
path: GuideConverter
- name: Checkout instructions
uses: actions/checkout@v2
with:
repository: OpenLiberty/cloud-hosted-guides
path: GuideConverter/cloud-hosted-guides
ref: ${{ github.event.pull_request.branch }}
- uses: actions/setup-java@v1
with:
java-version: '16' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Get Guide name
run: |
cd GuideConverter
instructionsMD=`echo "cloud_hosted_${{matrix.guides.guide}}" | sed -e 's/-/_/g'`
echo $instructionsMD
if [ -f "cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/instructions.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/instructions"; elif [ -f "cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/labs/${instructionsMD}.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/labs/${instructionsMD}"; elif [ -f "cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/labs/instructions.md" ]; then mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/labs/instructions"; else mvn -ntp -Dtest=TestConversion test -DguideName="cloud-hosted-guides/instructions/cloud-hosted-${{matrix.guides.guide}}/labs/cloud-hosted-${{matrix.guides.guide}}"; fi