Skip to content

Merge pull request #267 from zowe/reboot/dep-upgrade #458

Merge pull request #267 from zowe/reboot/dep-upgrade

Merge pull request #267 from zowe/reboot/dep-upgrade #458

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: ${{ secrets.SSH_MARIST_RACF_HOST }}
ZOSMF_PORT: 10443
GATEWAY_PORT: 7554
JOBS_PORT: 8443
JOBS_LOG_DIR: .apiml/jobs-api.log
jobs:
UnitTest:
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
path: |
build/reports/jacoco/jacocoFullReport/html
jobs-api-server/build/reports/tests/test
- uses: ./.github/actions/teardown
IntegrationTest:
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: 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: |
# start.sh uses $(pwd)/bin to locate jar file
mkdir ./bin
cp jobs-api-server/build/libs/jobs-api-server-*.jar ./bin
chmod +x ./bin/jobs-api-server-*.jar
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:
ZWE_configs_debug: true
ZWE_configs_port: ${{ env.JOBS_PORT }}
ZWE_configs_certificate_keystore_alias: localhost
ZWE_configs_certificate_keystore_file: .apiml/keystore/localhost.keystore.p12
ZWE_configs_certificate_keystore_password: password
ZWE_components_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
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: 17
- 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