Added trigger for L2 tests and compiled typescript (#28)

This commit is contained in:
Sundar 2021-03-31 17:22:13 +05:30 коммит произвёл GitHub
Родитель 932ea730f0
Коммит 047185b85f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 80 добавлений и 2 удалений

33
.github/workflows/TriggerIntegrationTests.sh поставляемый Normal file
Просмотреть файл

@ -0,0 +1,33 @@
token=$1
commit=$2
repository=$3
prNumber=$4
frombranch=$5
tobranch=$6
patUser=$7
getPayLoad() {
cat <<EOF
{
"event_type": "AKSSetContextPR",
"client_payload":
{
"action": "AKSSetContext",
"commit": "$commit",
"repository": "$repository",
"prNumber": "$prNumber",
"tobranch": "$tobranch",
"frombranch": "$frombranch"
}
}
EOF
}
response=$(curl -u $patUser:$token -X POST https://api.github.com/repos/Azure/azure-actions-integration-tests/dispatches --data "$(getPayLoad)")
if [ "$response" == "" ]; then
echo "Integration tests triggered successfully"
else
echo "Triggering integration tests failed with: '$response'"
exit 1
fi

19
.github/workflows/integration-tests.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,19 @@
name: "Trigger Integration tests"
on:
pull_request:
branches:
- master
- 'releases/*'
jobs:
trigger-integration-tests:
name: Trigger Integration tests
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
path: IntegrationTests
- name: Trigger Test run
run: |
bash ./IntegrationTests/.github/workflows/TriggerIntegrationTests.sh ${{ secrets.L2_REPO_TOKEN }} ${{ github.event.pull_request.head.sha }} ${{ github.repository }} ${{ github.event.pull_request.number }} ${{ github.event.pull_request.head.ref }} ${{ github.event.pull_request.base.ref }} ${{ secrets.L2_REPO_USER }}

21
.github/workflows/unit-tests.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
name: "Run L0 tests."
on: # rebuild any PRs and main branch changes
pull_request:
branches:
- master
- 'releases/*'
push:
branches:
- master
- 'releases/*'
jobs:
build: # make sure build/ci works properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run L0 tests.
run: |
npm install
npm test

Просмотреть файл

@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = exports.getKubeconfig = exports.getAKSKubeconfig = void 0;
const core = require("@actions/core");
const path = require("path");
const fs = require("fs");
@ -37,6 +38,7 @@ function getAKSKubeconfig(azureSessionToken, subscriptionId, managementEndpointU
}).catch(reject);
});
}
exports.getAKSKubeconfig = getAKSKubeconfig;
function getKubeconfig() {
return __awaiter(this, void 0, void 0, function* () {
let creds = core.getInput('creds', { required: true });
@ -54,6 +56,7 @@ function getKubeconfig() {
return kubeconfig;
});
}
exports.getKubeconfig = getKubeconfig;
function run() {
return __awaiter(this, void 0, void 0, function* () {
let kubeconfig = yield getKubeconfig();
@ -66,4 +69,5 @@ function run() {
console.log('KUBECONFIG environment variable is set');
});
}
exports.run = run;
run().catch(core.setFailed);

Просмотреть файл

@ -4,7 +4,7 @@
"private": true,
"main": "lib/login.js",
"scripts": {
"build": "tsc",
"build": "tsc --outDir ./lib --rootDir ./src",
"test": "jest",
"test-coverage": "jest --coverage"
},

Просмотреть файл

@ -6,6 +6,7 @@
"outDir": "./lib"
},
"exclude": [
"node_modules"
"node_modules",
"__tests__"
]
}