Skip to content

Merge pull request #254 from zowe/revert-spring-framework #406

Merge pull request #254 from zowe/revert-spring-framework

Merge pull request #254 from zowe/revert-spring-framework #406

Workflow file for this run

name: CI Testing
on:
push:
branches:
- v1.x/master
- v2.x/master
pull_request:
branches:
- v1.x/master
- v2.x/master
workflow_dispatch:
env:
MARIST_HOST: 'zzow04.zowe.marist.cloud'
ZOSMF_PORT: 10443
GATEWAY_PORT: 7554
JOBS_PORT: 8443
JOBS_LOG_DIR: .apiml/jobs-api.log
JOB_ID: ${{ github.run_id }}-${{ github.run_number }}
jobs:
UnitTest:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/setup
- name: Build with Gradle
run: ./gradlew build
- name: Unit test with Gradle
run: ./gradlew coverage
- name: Store test results
uses: actions/upload-artifact@v2
if: always()
with:
name: UnitTestResults-${{ env.JOB_ID }}
path: |
build/reports/jacoco/jacocoFullReport/html
jobs-api-server/build/reports/tests/test
- uses: ./.github/actions/teardown
IntegrationTest:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/setup
- name: Build with Gradle
run: ./gradlew build
- name: Run APIML containers
run: |
chmod +x scripts/run-containerized-apiml.sh
./scripts/run-containerized-apiml.sh -h ${{ env.MARIST_HOST }} -p ${{ env.ZOSMF_PORT }} -f ${{ env.JOBS_PORT }} -l
env:
GATEWAY_PORT: ${{ env.GATEWAY_PORT }}
- name: Run Jobs API server
run: |
chmod +x jobs-zowe-server-package/src/main/resources/bin/start.sh
./jobs-zowe-server-package/src/main/resources/bin/start.sh > ${{ env.JOBS_LOG_DIR }} &
env:
LAUNCH_COMPONENT: jobs-api-server/build/libs # point start.sh to jar file directory
EXPLORER_API_LOG_LEVEL: debug
JOBS_API_PORT: ${{ env.JOBS_PORT }}
KEY_ALIAS: localhost
KEYSTORE: .apiml/keystore/localhost.keystore.p12
KEYSTORE_PASSWORD: password
GATEWAY_PORT: ${{ env.GATEWAY_PORT }}
- name: Validate APIML setup
# poll for 3 minutes, if GW not healthy after 2 minutes then exit
run: |
set +e # curl -s doesn't swallow the error alone
attemptCounter=1
maxAttempts=18
until [ $attemptCounter -gt $maxAttempts ]; do
sleep 10
gwHealth=$(curl -k -s https://localhost:${{ env.GATEWAY_PORT }}/application/health)
echo "Polling for GW health: $attemptCounter"
echo $gwHealth
gatewayUp=$(echo $gwHealth | jq -r '.status')
authUp=$(echo $gwHealth | jq -r '.components.gateway.details.auth')
if [ "$gatewayUp" = "UP" ] && [ "$authUp" = "UP" ]; then
echo ">>>>>APIML is ready"
break
fi
attemptCounter=$((attemptCounter+1))
done
if [ "$gatewayUp" != "UP" ] || [ "$authUp" != "UP" ]; then
echo ">>>>>APIML is not ready"
exit 1
fi
- uses: zowe-actions/shared-actions/prepare-workflow@main
- name: Lock marist server
uses: zowe-actions/shared-actions/lock-resource@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lock-resource-name: jobs-integration-tests-${{ env.MARIST_HOST }}-lock
lock-avg-retry-interval: 60
- name: Integration tests for v1 - LTPA
run: >
./gradlew runIntegrationTests --info
-Pserver.host=localhost
-Pserver.port=${{ env.GATEWAY_PORT }}
-Pserver.username=${{ secrets.SSH_MARIST_USERNAMEP }}
-Pserver.password=${{ secrets.SSH_MARIST_PASSWORDP }}
-Ptest.version=1
- name: Integration tests for v2 - JWT
run: >
./gradlew runIntegrationTests --info
-Pserver.host=localhost
-Pserver.port=${{ env.GATEWAY_PORT }}
-Pserver.username=${{ secrets.SSH_MARIST_USERNAMEP }}
-Pserver.password=${{ secrets.SSH_MARIST_PASSWORDP }}
-Ptest.version=2
- name: Output Jobs API logs
if: always()
run: >
if [ -f ${{ env.JOBS_LOG_DIR }} ]; then
echo ">>>>>Jobs API logs"
cat ${{ env.JOBS_LOG_DIR }}
else
echo ">>>>>No Jobs API logs"
fi
- name: Output APIML logs
if: always()
run: docker-compose -f .apiml/docker-compose.yml logs
- name: Store test results
uses: actions/upload-artifact@v2
if: always()
with:
name: IntegrationTestResults-${{ env.JOB_ID }}
path: |
jobs-tests/build/reports/tests/test-1
jobs-tests/build/reports/tests/test-2
- uses: ./.github/actions/teardown
SonarQubeScan:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/setup
with:
jdkVersion: 11
- name: Sonar scan with Gradle
run: >
./gradlew compileJava compileTestJava sonarqube --info
-x test
-Psonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN
-Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: ./.github/actions/teardown