Bump ts-jest from 27.1.5 to 29.2.6 #609
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
name: Testing the action | |
on: | |
push: | |
paths: | |
- ".github/workflows/testing.yml" | |
- "/lib/*" | |
- "/src/*" | |
- "/action.yml" | |
workflow_dispatch: | |
env: | |
organization: devops-actions | |
repo: load-runner-info | |
# Declare default GITHUB_TOKEN permissions as read only. | |
permissions: read-all | |
jobs: | |
build: # make sure build/ci work properly | |
runs-on: ubuntu-latest | |
#if: github.ref == 'refs/heads/main' # don't run on PRs | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2.5.0 | |
- run: npm ci | |
- run: npm run all | |
test-from-organization: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get GitHub Application Token | |
id: get_workflow_token | |
uses: peter-murray/workflow-application-token-action@d17e3a9a36850ea89f35db16c1067dd2b68ee343 # v3 | |
with: | |
application_id: ${{ vars.DEVOPS_ACTIONS_APPLICATION_ID }} | |
application_private_key: ${{ secrets.DEVOPS_ACTIONS_APPLICATION_KEY }} | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2.5.0 | |
- uses: ./ | |
id: load-runner-info-org | |
with: | |
accessToken: ${{ steps.get_workflow_token.outputs.token }} | |
organization: ${{ env.organization }} | |
- name: Store output in result files | |
run: | | |
echo '${{ steps.load-runner-info-org.outputs.runners }}' > 'runners-organization.json' | |
echo '${{ steps.load-runner-info-org.outputs.grouped }}' > 'runners-grouped-organization.json' | |
- name: Upload result file as artefact for inspection | |
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 | |
with: | |
name: runners-organization-${{ env.organization }} | |
path: 'runners-**.json' | |
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
name: Test runner info | |
with: | |
script: | | |
const info = JSON.parse(`${{ steps.load-runner-info-org.outputs.runners }}`) | |
if (info.length == 0) { | |
core.error('No runners found') | |
return | |
} | |
console.log(`Found [${info.runners.length}] runner(s)`) | |
for (let num = 0; num < info.runners.length; num++) { | |
const runner = info.runners[num] | |
console.log(`- name: [${runner.name}]`) | |
} | |
console.log(``) | |
const grouped = JSON.parse(`${{ steps.load-runner-info-org.outputs.grouped }}`) | |
console.log(`Found ${grouped.length} runner label(s)`) | |
for (let num = 0; num < grouped.length; num++) { | |
const group = grouped[num] | |
console.log(`- label: [${group.name}], runner with this label: [${group.counter}] with [${group.status}] online runners`) | |
} | |
// find the runner with the label 'self-hosted' | |
const selfHosted = grouped.find(label => label.name === 'self-hosted') | |
if (!selfHosted) { | |
core.error('No runner with label "self-hosted" found') | |
return | |
} | |
// example of a test you can do on the amount of runners online with this label | |
if (selfHosted.status > 10) { | |
core.error('Too many runners with label "self-hosted" found') | |
return | |
} | |
- name: Test if result files are not empty | |
run: | | |
runnersFile=${{ steps.load-runner-info-org.outputs.runners-file-location }} | |
if [ ! -s $runnersFile ]; then | |
echo "File [$runnersFile] is empty" | |
exit 1 | |
fi | |
groupedFile=${{ steps.load-runner-info-org.outputs.grouped-file-location }} | |
if [ ! -s $groupedFile ]; then | |
echo "File [$groupedFile] is empty" | |
exit 1 | |
fi |