Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add test to ensure plugins support latest module versions #670

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ browsers_unit_tests: &browsers_unit_tests
command: if [ "$CIRCLE_NODE_VERSION" = "v12" ]; then yarn codecov:browser; fi

jobs:
check-plugin-supported-versions:
docker:
- image: node:12
steps:
- checkout
- run:
name: Install Dependencies
command: yarn install
- run:
name: Compile code
command: yarn compile
- run:
name: Check plugin supported versions
command: yarn check-plugin-supported-versions
lint_&_docs:
docker:
- image: node:12
Expand Down Expand Up @@ -224,6 +238,16 @@ jobs:

workflows:
version: 2
nightly:
jobs:
- check-plugin-supported-versions
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
build:
jobs:
- lint_&_docs:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"precompile": "tsc --version",
"version:update": "lerna run version:update",
"compile": "lerna run compile",
"check-plugin-supported-versions": "scripts/check-plugin-supported-versions.sh",
"test": "lerna run test",
"test:browser": "lerna run test:browser",
"bootstrap": "lerna bootstrap",
Expand Down
17 changes: 17 additions & 0 deletions scripts/check-plugin-supported-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const [node, script, pack] = process.argv;

const child_process = require("child_process");

const plugin = require(pack).plugin;
const isSupportedVersion = require("../packages/opentelemetry-node/build/src/instrumentation/utils").isSupportedVersion;

if (plugin && plugin.supportedVersions) {
const version = child_process.execSync(`npm show ${plugin.moduleName} version`).toString("utf-8").trim();
if (!isSupportedVersion(version, plugin.supportedVersions)) {
console.log(`${plugin.moduleName} does not support ${version}. Supported versions: ${JSON.stringify(plugin.supportedVersions)}`);
process.exit(1);
} else {
console.log(`${plugin.moduleName} supports the latest version`);
}
}

10 changes: 10 additions & 0 deletions scripts/check-plugin-supported-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# exit if any command fails
set -e

packages=$(lerna list -p --scope @opentelemetry/plugin-*)
for package in $packages
do
node scripts/check-plugin-supported-versions.js $package
done