Skip to content

To Prod: Change to cloud-hosted-guide-microprofile-telemetry-jaeger #2879

To Prod: Change to cloud-hosted-guide-microprofile-telemetry-jaeger

To Prod: Change to cloud-hosted-guide-microprofile-telemetry-jaeger #2879

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