mirror of
https://github.com/status-im/libp2p-test-plans.git
synced 2025-02-20 02:28:11 +00:00
Introduce composite action for running ping interop tests (#123)
Co-authored-by: Marco Munizaga <git@marcopolo.io>
This commit is contained in:
parent
7fd08bfd80
commit
c9130e425d
79
.github/actions/run-interop-ping-test/action.yml
vendored
Normal file
79
.github/actions/run-interop-ping-test/action.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
name: "libp2p ping interop test"
|
||||||
|
description: "Run the libp2p ping interoperability test suite"
|
||||||
|
inputs:
|
||||||
|
test-filter:
|
||||||
|
description: "Filter which tests to run out of the created matrix"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
extra-versions:
|
||||||
|
description: "Space-separated paths to JSON files describing additional images"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
# This depends on where this file is within this repository. This walks up
|
||||||
|
# from here to the multidim-interop folder
|
||||||
|
- run: |
|
||||||
|
WORK_DIR=$(realpath "${{ github.action_path }}/../../../multidim-interop")
|
||||||
|
echo "WORK_DIR=$WORK_DIR" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
|
id: find-workdir
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Expose GitHub Runtime # Needed for docker buildx to cache properly (See https://docs.docker.com/build/cache/backends/gha/#authentication)
|
||||||
|
uses: crazy-max/ghaction-github-runtime@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: npm ci
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build images
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: make
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Run the test
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: WORKER_COUNT=2 npm run test -- --extra-version=${{ inputs.extra-versions }} --name-filter=${{ inputs.test-filter }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Print the results
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: cat results.csv
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Render results
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: npm run renderResults > ./dashboard.md
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Show Dashboard Output
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: cat ./dashboard.md >> $GITHUB_STEP_SUMMARY
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Exit with Error
|
||||||
|
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
|
||||||
|
run: |
|
||||||
|
if grep -q ":red_circle:" ./dashboard.md; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: test-plans-output
|
||||||
|
path: |
|
||||||
|
${{ steps.find-workdir.outputs.WORK_DIR }}/results.csv
|
||||||
|
${{ steps.find-workdir.outputs.WORK_DIR }}/dashboard.md
|
5
.github/workflows/multidim-interop.yml
vendored
5
.github/workflows/multidim-interop.yml
vendored
@ -12,3 +12,8 @@ jobs:
|
|||||||
uses: "./.github/workflows/run-testplans.yml"
|
uses: "./.github/workflows/run-testplans.yml"
|
||||||
with:
|
with:
|
||||||
dir: "multidim-interop"
|
dir: "multidim-interop"
|
||||||
|
run-multidim-interop-ng:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/run-interop-ping-test
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"description": "Tests libp2p implementations against each other across various dimensions.",
|
"description": "Tests libp2p implementations against each other across various dimensions.",
|
||||||
"main": "testplans.ts",
|
"main": "testplans.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "ts-node -O '{\"resolveJsonModule\": true}' testplans.ts",
|
"test": "ts-node testplans.ts",
|
||||||
"renderResults": "ts-node renderResults.ts"
|
"renderResults": "ts-node renderResults.ts"
|
||||||
},
|
},
|
||||||
"author": "marcopolo",
|
"author": "marcopolo",
|
||||||
|
@ -26,6 +26,11 @@ import path from "path";
|
|||||||
default: "",
|
default: "",
|
||||||
type: 'string'
|
type: 'string'
|
||||||
},
|
},
|
||||||
|
'extra-version': {
|
||||||
|
description: 'Paths to JSON files for additional versions to include in the test matrix',
|
||||||
|
default: [],
|
||||||
|
type: 'array'
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.help()
|
.help()
|
||||||
.version(false)
|
.version(false)
|
||||||
@ -45,6 +50,11 @@ import path from "path";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let versionPath of argv.extraVersion.filter(p => p !== "")) {
|
||||||
|
const contents = await fs.readFile(versionPath);
|
||||||
|
extraVersions.push(JSON.parse(contents.toString()))
|
||||||
|
}
|
||||||
|
|
||||||
let testSpecs = await buildTestSpecs(versions.concat(extraVersions))
|
let testSpecs = await buildTestSpecs(versions.concat(extraVersions))
|
||||||
|
|
||||||
const nameFilter = argv["name-filter"]
|
const nameFilter = argv["name-filter"]
|
||||||
@ -87,4 +97,4 @@ import path from "path";
|
|||||||
await fs.writeFile("results.csv", stringify(statuses))
|
await fs.writeFile("results.csv", stringify(statuses))
|
||||||
|
|
||||||
console.log("Run complete")
|
console.log("Run complete")
|
||||||
})()
|
})()
|
||||||
|
6
multidim-interop/tsconfig.json
Normal file
6
multidim-interop/tsconfig.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user