-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #756 from wso2/tharindu1st-patch-2
Create integration-test.yml
- Loading branch information
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: start and run postman collection | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: Create AKS Cluster and set context | ||
uses: azure/CLI@v1 | ||
with: | ||
azcliversion: 2.44.1 | ||
inlineScript: | | ||
az aks create --resource-group "${{ secrets.AZURE_RESOURCE_GROUP }}" --name "${{ secrets.AKS_CLUSTER_NAME }}" --enable-cluster-autoscaler --min-count 1 --max-count 3 --location "southeastasia" --generate-ssh-keys --verbose | ||
- uses: azure/aks-set-context@v3 | ||
with: | ||
resource-group: '${{ secrets.AZURE_RESOURCE_GROUP }}' | ||
cluster-name: '${{ secrets.AKS_CLUSTER_NAME }}' | ||
- name: Create Namespace apk-release | ||
shell: sh | ||
run: | | ||
kubectl create namespace apk-release | ||
kubectl get ns | ||
- name: Checkout apk-repo. | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" | ||
path: apk-repo | ||
token: ${{ secrets.WSO2_BOT_TOKEN }} | ||
- name: Helm release deploy | ||
shell: sh | ||
run: | | ||
cd apk-repo/helm-charts | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm dependency build | ||
helm install release-1 -n apk-release . --debug --wait --timeout 10m0s | ||
kubectl get pods -n apk-release | ||
kubectl get svc -n apk-release | ||
- name: Apply test resources | ||
shell: sh | ||
run: | | ||
cd apk-repo/test/k8s-resources | ||
kubectl apply -f . | ||
- name: Retrieve Router IP | ||
id: retrieveIp | ||
run: | | ||
echo "router_ip=`kubectl get svc release-1-wso2-apk-router-service -n apk-release --output jsonpath='{.status.loadBalancer.ingress[0].ip}'`">> $GITHUB_OUTPUT | ||
- name: Run test cases | ||
shell: sh | ||
run: | | ||
cd apk-repo/test/postman-tests | ||
./gradlew test -PgwHost=${{ steps.retrieveIp.outputs.router_ip }} | ||
- name: Helm release undeploy | ||
if: always() | ||
shell: sh | ||
run: | | ||
cd apk-repo/helm-charts | ||
helm uninstall release-1 -n apk-release | ||
kubectl get pods -n apk-release | ||
kubectl get svc -n apk-release | ||
- name: Delete AKS cluster | ||
if: always() | ||
uses: azure/CLI@v1 | ||
with: | ||
azcliversion: 2.44.1 | ||
inlineScript: | | ||
az aks delete --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --name ${{ secrets.AKS_CLUSTER_NAME }} --yes | ||
- name: Logout from azure | ||
if: always() | ||
uses: azure/CLI@v1 | ||
with: | ||
azcliversion: 2.44.1 | ||
inlineScript: | | ||
az logout | ||
- name: Publish Test Report | ||
if: always() | ||
uses: malinthaprasan/action-surefire-report@v1 | ||
with: | ||
report_paths: 'apk-repo/test/postman-tests/build/*.xml' | ||
- name: Archive testng report | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: | | ||
report_paths: 'apk-repo/test/postman-tests/build/*.xml' | ||
if-no-files-found: warn |