From 1e081f3613c2eaa302b66837193a4ce813046081 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Fri, 30 Sep 2022 04:49:02 +0200
Subject: [PATCH 01/14] Add release watchdog (#1192)
* Add a release watchdog
* Move timeout to step
* Update release.yml
* Update release.yml
* Update release.yml
* Update release.yml
* Update release.yml
ens
---
.github/workflows/images.yml | 9 +++++++--
.github/workflows/release.yml | 13 +++++++++----
.github/workflows/test-deploy.yml | 11 ++++++++---
3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml
index b885a6c88..5b347d9d0 100644
--- a/.github/workflows/images.yml
+++ b/.github/workflows/images.yml
@@ -1,4 +1,9 @@
-on: workflow_call
+on:
+ workflow_call:
+ inputs:
+ release:
+ required: true
+ type: boolean
jobs:
images:
runs-on: ubuntu-latest
@@ -89,7 +94,7 @@ jobs:
- uses: docker/build-push-action@v2
with:
push:
- ${{ github.event_name == 'push' || github.event_name == 'schedule'
+ ${{ inputs.release || github.event_name == 'push' || github.event_name == 'schedule'
|| github.event_name == 'workflow_dispatch' }}
context: ./
file: ./Dockerfile
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 32b18cd03..16e7c0c77 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -20,7 +20,7 @@ jobs:
git config --global user.name Olivaw[bot]
git config --global user.email 64868532+iterative-olivaw@users.noreply.github.com
git checkout -b bump/$(npm version ${{ github.event.inputs.bump }})
- git push --set-upstream origin --follow-tags HEAD
+ git push --set-upstream origin HEAD
gh pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖"
gh pr merge --auto --squash
env:
@@ -30,12 +30,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - run:
- gh release create --draft --generate-notes {--title=CML\ ,}$(basename
- ${{ github.head_ref }})
+ - run: >
+ gh release create
+ --target ${{ github.event.pull_request.merge_commit_sha }}
+ {--title=CML\ ,}$(basename ${{ github.head_ref }})
+ --generate-notes
+ --draft
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
package:
needs: release
secrets: inherit
uses: ./.github/workflows/test-deploy.yml
+ with:
+ release: true
diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml
index ef3d0a0e9..05333b1ef 100644
--- a/.github/workflows/test-deploy.yml
+++ b/.github/workflows/test-deploy.yml
@@ -3,6 +3,10 @@ on:
pull_request_target:
workflow_dispatch:
workflow_call:
+ inputs:
+ release:
+ required: true
+ type: boolean
schedule:
- cron: '0 8 * * 1' # M H d m w (Mondays at 8:00)
jobs:
@@ -98,8 +102,7 @@ jobs:
registry-url: https://registry.npmjs.org
- run: npm install
- run:
- npm ${{ github.event_name == 'workflow_call' && 'publish' || 'publish
- --dry-run' }}
+ npm ${{ inputs.release && 'publish' || 'publish --dry-run' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: install ldid
@@ -120,7 +123,7 @@ jobs:
cp build/cml-linux{-x64,}
cp build/cml-macos{-x64,}
- uses: softprops/action-gh-release@v1
- if: github.event_name == 'workflow_call'
+ if: inputs.release
with:
files: |
build/cml-alpine-arm64
@@ -141,3 +144,5 @@ jobs:
needs: packages
secrets: inherit
uses: ./.github/workflows/images.yml
+ with:
+ release: ${{ inputs.release }}
From d406a2a07f7f0ae06af0755220537bcd07a483a2 Mon Sep 17 00:00:00 2001
From: "Olivaw[bot]" <64868532+iterative-olivaw@users.noreply.github.com>
Date: Fri, 30 Sep 2022 06:27:02 +0200
Subject: [PATCH 02/14] 0.18.1 (#1198)
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 00cbfac26..dde81db9f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.0",
+ "version": "0.18.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dvcorg/cml",
- "version": "0.18.0",
+ "version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.9.1",
diff --git a/package.json b/package.json
index 2ca9f2339..13ea8c600 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.0",
+ "version": "0.18.1",
"description": "
",
"author": {
"name": "Iterative Inc",
From f34a0892691e64caa8a23db96276eb8b593153c0 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Sat, 1 Oct 2022 02:53:20 +0200
Subject: [PATCH 03/14] Exclude internal projects & tests from analytics
(#1199)
* Exclude internal projects & tests from analytics
* Exclude also Codespaces
* Fix typo
* Update analytics.js
* Use identifiers instead of raw values
---
src/analytics.js | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/analytics.js b/src/analytics.js
index b0399a955..239651569 100644
--- a/src/analytics.js
+++ b/src/analytics.js
@@ -21,6 +21,7 @@ const {
GITHUB_SERVER_URL,
GITHUB_REPOSITORY_OWNER,
GITHUB_ACTOR,
+ GITHUB_REPOSITORY,
CI_SERVER_URL,
CI_PROJECT_ROOT_NAMESPACE,
GITLAB_USER_NAME,
@@ -72,7 +73,7 @@ const groupId = async () => {
} else if (ci === 'gitlab') {
rawId = `${CI_SERVER_URL}/${CI_PROJECT_ROOT_NAMESPACE}`;
} else if (ci === 'bitbucket') {
- rawId = BITBUCKET_WORKSPACE;
+ rawId = `https://bitbucket.com/${BITBUCKET_WORKSPACE}`;
}
return await deterministic(rawId);
@@ -186,6 +187,22 @@ const send = async ({
if (ITERATIVE_DO_NOT_TRACK) return;
if (!event.user_id || event.user_id === ID_DO_NOT_TRACK) return;
+ // Exclude runs from GitHub Codespaces at Iterative
+ if (GITHUB_REPOSITORY.startsWith('iterative/')) return;
+
+ // Exclude continuous integration tests and internal projects from analytics
+ if (
+ [
+ 'dc16cd76-71b7-5afa-bf11-e85e02ee1554', // deterministic("https://github.com/iterative")
+ 'b0e229bf-2598-54b7-a3e0-81869cdad579', // deterministic("https://github.com/iterative-test")
+ 'd5aaeca4-fe6a-5c72-8aa7-6dcd65974973', // deterministic("https://gitlab.com/iterative.ai")
+ 'b6df227b-5b3d-5190-a8fa-d272b617ee6c', // deterministic("https://gitlab.com/iterative-test")
+ '2c6415f0-cb5a-5e52-8c81-c5af4f11715d', // deterministic("https://bitbucket.com/iterative-ai")
+ 'c0b86b90-d63c-5fb0-b84d-718d8e15f8d6' // deterministic("https://bitbucket.com/iterative-test")
+ ].includes(event.group_id)
+ )
+ return;
+
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), 5 * 1000);
await fetch(endpoint, {
From 4880a40057fabd844bfe2cdf6babd0dd6a771256 Mon Sep 17 00:00:00 2001
From: Casper da Costa-Luis
Date: Wed, 5 Oct 2022 01:14:17 +0100
Subject: [PATCH 04/14] npm audit fix (#1206)
---
package-lock.json | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index dde81db9f..0068608d3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7239,8 +7239,9 @@
}
},
"node_modules/vm2": {
- "version": "3.9.10",
- "license": "MIT",
+ "version": "3.9.11",
+ "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz",
+ "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==",
"dependencies": {
"acorn": "^8.7.0",
"acorn-walk": "^8.2.0"
@@ -12200,7 +12201,9 @@
}
},
"vm2": {
- "version": "3.9.10",
+ "version": "3.9.11",
+ "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz",
+ "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==",
"requires": {
"acorn": "^8.7.0",
"acorn-walk": "^8.2.0"
From 9cfa5aba464f6bfcf719489a7185cc621b8f7c90 Mon Sep 17 00:00:00 2001
From: Domas Monkus
Date: Thu, 6 Oct 2022 15:11:16 +0300
Subject: [PATCH 05/14] Separate unit tests and integration (e2e) tests (#1207)
---
.gitignore | 1 +
bin/cml/asset/publish.e2e.test.js | 82 +++++++++++
bin/cml/asset/publish.test.js | 81 +----------
bin/cml/check/create.e2e.test.js | 32 +++++
bin/cml/check/create.test.js | 29 ----
bin/cml/comment/create.e2e.test.js | 41 ++++++
bin/cml/comment/create.test.js | 38 -----
.../pr/{create.test.js => create.e2e.test.js} | 0
bin/cml/runner/launch.e2e.test.js | 130 ++++++++++++++++++
bin/cml/runner/launch.test.js | 129 +----------------
bin/cml/tensorboard/connect.e2e.test.js | 79 +++++++++++
bin/cml/tensorboard/connect.test.js | 78 +----------
bin/legacy/{link.test.js => link.e2e.test.js} | 0
package.json | 5 +-
...nalytics.test.js => analytics.e2e.test.js} | 0
src/{cml.test.js => cml.e2e.test.js} | 0
...ud.test.js => bitbucket_cloud.e2e.test.js} | 0
.../{github.test.js => github.e2e.test.js} | 0
.../{gitlab.test.js => gitlab.e2e.test.js} | 0
19 files changed, 372 insertions(+), 353 deletions(-)
create mode 100644 bin/cml/asset/publish.e2e.test.js
create mode 100644 bin/cml/check/create.e2e.test.js
create mode 100644 bin/cml/comment/create.e2e.test.js
rename bin/cml/pr/{create.test.js => create.e2e.test.js} (100%)
create mode 100644 bin/cml/runner/launch.e2e.test.js
create mode 100644 bin/cml/tensorboard/connect.e2e.test.js
rename bin/legacy/{link.test.js => link.e2e.test.js} (100%)
rename src/{analytics.test.js => analytics.e2e.test.js} (100%)
rename src/{cml.test.js => cml.e2e.test.js} (100%)
rename src/drivers/{bitbucket_cloud.test.js => bitbucket_cloud.e2e.test.js} (100%)
rename src/drivers/{github.test.js => github.e2e.test.js} (100%)
rename src/drivers/{gitlab.test.js => gitlab.e2e.test.js} (100%)
diff --git a/.gitignore b/.gitignore
index 1052816e0..000f8d81c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ terraform.*
!terraform.test.js
crash.log
/build
+/coverage
diff --git a/bin/cml/asset/publish.e2e.test.js b/bin/cml/asset/publish.e2e.test.js
new file mode 100644
index 000000000..2475f710e
--- /dev/null
+++ b/bin/cml/asset/publish.e2e.test.js
@@ -0,0 +1,82 @@
+const fs = require('fs');
+const { exec } = require('../../../src/utils');
+
+describe('CML e2e', () => {
+ test('cml publish assets/logo.png --md', async () => {
+ const output = await exec(`node ./bin/cml.js publish assets/logo.png --md`);
+
+ expect(output.startsWith('![](')).toBe(true);
+ });
+
+ test('cml publish assets/logo.png', async () => {
+ const output = await exec(`node ./bin/cml.js publish assets/logo.png`);
+
+ expect(output.startsWith('https://')).toBe(true);
+ });
+
+ test('cml publish assets/logo.pdf --md', async () => {
+ const title = 'this is awesome';
+ const output = await exec(
+ `node ./bin/cml.js publish assets/logo.pdf --md --title '${title}'`
+ );
+
+ expect(output.startsWith(`[${title}](`)).toBe(true);
+ });
+
+ test('cml publish assets/logo.pdf', async () => {
+ const output = await exec(`node ./bin/cml.js publish assets/logo.pdf`);
+
+ expect(output.startsWith('https://')).toBe(true);
+ });
+
+ test('cml publish assets/test.svg --md', async () => {
+ const title = 'this is awesome';
+ const output = await exec(
+ `node ./bin/cml.js publish assets/test.svg --md --title '${title}'`
+ );
+
+ expect(output.startsWith('![](') && output.endsWith(`${title}")`)).toBe(
+ true
+ );
+ });
+
+ test('cml publish assets/test.svg', async () => {
+ const output = await exec(`node ./bin/cml.js publish assets/test.svg`);
+
+ expect(output.startsWith('https://')).toBe(true);
+ });
+
+ test('cml publish assets/logo.pdf to file', async () => {
+ const file = `cml-publish-test.md`;
+
+ await exec(`node ./bin/cml.js publish assets/logo.pdf --file ${file}`);
+
+ expect(fs.existsSync(file)).toBe(true);
+ await fs.promises.unlink(file);
+ });
+
+ test('cml publish assets/vega-lite.json', async () => {
+ const output = await exec(
+ `node ./bin/cml.js publish --mime-type=application/json assets/vega-lite.json`
+ );
+
+ expect(output.startsWith('https://')).toBe(true);
+ expect(output.includes('cml=json')).toBe(true);
+ });
+
+ test('cml publish assets/test.svg in Gitlab storage', async () => {
+ const { TEST_GITLAB_REPO: repo, TEST_GITLAB_TOKEN: token } = process.env;
+
+ const output = await exec(
+ `node ./bin/cml.js publish --repo=${repo} --token=${token} --gitlab-uploads assets/test.svg`
+ );
+
+ expect(output.startsWith('https://')).toBe(true);
+ });
+
+ test('cml publish /nonexistent produces file error', async () => {
+ await expect(
+ exec('node ./bin/cml.js publish /nonexistent')
+ ).rejects.toThrowError('ENOENT');
+ });
+});
diff --git a/bin/cml/asset/publish.test.js b/bin/cml/asset/publish.test.js
index a96fb947e..0d130912d 100644
--- a/bin/cml/asset/publish.test.js
+++ b/bin/cml/asset/publish.test.js
@@ -1,7 +1,6 @@
-const fs = require('fs');
const { exec } = require('../../../src/utils');
-describe('CML e2e', () => {
+describe('CML cli test', () => {
test('cml publish --help', async () => {
const output = await exec(`node ./bin/cml.js publish --help`);
@@ -29,82 +28,4 @@ describe('CML e2e', () => {
--mime-type MIME type [string] [default: infer from the file contents]"
`);
});
-
- test('cml publish assets/logo.png --md', async () => {
- const output = await exec(`node ./bin/cml.js publish assets/logo.png --md`);
-
- expect(output.startsWith('![](')).toBe(true);
- });
-
- test('cml publish assets/logo.png', async () => {
- const output = await exec(`node ./bin/cml.js publish assets/logo.png`);
-
- expect(output.startsWith('https://')).toBe(true);
- });
-
- test('cml publish assets/logo.pdf --md', async () => {
- const title = 'this is awesome';
- const output = await exec(
- `node ./bin/cml.js publish assets/logo.pdf --md --title '${title}'`
- );
-
- expect(output.startsWith(`[${title}](`)).toBe(true);
- });
-
- test('cml publish assets/logo.pdf', async () => {
- const output = await exec(`node ./bin/cml.js publish assets/logo.pdf`);
-
- expect(output.startsWith('https://')).toBe(true);
- });
-
- test('cml publish assets/test.svg --md', async () => {
- const title = 'this is awesome';
- const output = await exec(
- `node ./bin/cml.js publish assets/test.svg --md --title '${title}'`
- );
-
- expect(output.startsWith('![](') && output.endsWith(`${title}")`)).toBe(
- true
- );
- });
-
- test('cml publish assets/test.svg', async () => {
- const output = await exec(`node ./bin/cml.js publish assets/test.svg`);
-
- expect(output.startsWith('https://')).toBe(true);
- });
-
- test('cml publish assets/logo.pdf to file', async () => {
- const file = `cml-publish-test.md`;
-
- await exec(`node ./bin/cml.js publish assets/logo.pdf --file ${file}`);
-
- expect(fs.existsSync(file)).toBe(true);
- await fs.promises.unlink(file);
- });
-
- test('cml publish assets/vega-lite.json', async () => {
- const output = await exec(
- `node ./bin/cml.js publish --mime-type=application/json assets/vega-lite.json`
- );
-
- expect(output.startsWith('https://')).toBe(true);
- expect(output.includes('cml=json')).toBe(true);
- });
-
- test('cml publish assets/test.svg in Gitlab storage', async () => {
- const { TEST_GITLAB_REPO: repo, TEST_GITLAB_TOKEN: token } = process.env;
-
- const output = await exec(
- `node ./bin/cml.js publish --repo=${repo} --token=${token} --gitlab-uploads assets/test.svg`
- );
-
- expect(output.startsWith('https://')).toBe(true);
- });
-
- test('cml publish /nonexistent produces file error', async () => {
- await expect(
- exec('node ./bin/cml.js publish /nonexistent')
- ).rejects.toThrowError('ENOENT');
- });
});
diff --git a/bin/cml/check/create.e2e.test.js b/bin/cml/check/create.e2e.test.js
new file mode 100644
index 000000000..67d2a38b1
--- /dev/null
+++ b/bin/cml/check/create.e2e.test.js
@@ -0,0 +1,32 @@
+const { exec } = require('../../../src/utils');
+const fs = require('fs').promises;
+
+describe('CML e2e', () => {
+ const path = 'check.md';
+
+ afterEach(async () => {
+ try {
+ await fs.unlink(path);
+ } catch (err) {}
+ });
+
+ test('cml send-github-check', async () => {
+ const report = `## Test Check Report`;
+
+ await fs.writeFile(path, report);
+ process.env.GITHUB_ACTIONS &&
+ (await exec(`node ./bin/cml.js send-github-check ${path}`));
+ });
+
+ test('cml send-github-check failure with tile "CML neutral test"', async () => {
+ const report = `## Hi this check should be neutral`;
+ const title = 'CML neutral test';
+ const conclusion = 'neutral';
+
+ await fs.writeFile(path, report);
+ process.env.GITHUB_ACTIONS &&
+ (await exec(
+ `node ./bin/cml.js send-github-check ${path} --title "${title}" --conclusion "${conclusion}"`
+ ));
+ });
+});
diff --git a/bin/cml/check/create.test.js b/bin/cml/check/create.test.js
index 28d61c365..29d2975d5 100644
--- a/bin/cml/check/create.test.js
+++ b/bin/cml/check/create.test.js
@@ -1,35 +1,6 @@
const { exec } = require('../../../src/utils');
-const fs = require('fs').promises;
describe('CML e2e', () => {
- const path = 'check.md';
-
- afterEach(async () => {
- try {
- await fs.unlink(path);
- } catch (err) {}
- });
-
- test('cml send-github-check', async () => {
- const report = `## Test Check Report`;
-
- await fs.writeFile(path, report);
- process.env.GITHUB_ACTIONS &&
- (await exec(`node ./bin/cml.js send-github-check ${path}`));
- });
-
- test('cml send-github-check failure with tile "CML neutral test"', async () => {
- const report = `## Hi this check should be neutral`;
- const title = 'CML neutral test';
- const conclusion = 'neutral';
-
- await fs.writeFile(path, report);
- process.env.GITHUB_ACTIONS &&
- (await exec(
- `node ./bin/cml.js send-github-check ${path} --title "${title}" --conclusion "${conclusion}"`
- ));
- });
-
test('cml send-github-check --help', async () => {
const output = await exec(`node ./bin/cml.js send-github-check --help`);
diff --git a/bin/cml/comment/create.e2e.test.js b/bin/cml/comment/create.e2e.test.js
new file mode 100644
index 000000000..31398bbaf
--- /dev/null
+++ b/bin/cml/comment/create.e2e.test.js
@@ -0,0 +1,41 @@
+const { exec } = require('../../../src/utils');
+const fs = require('fs').promises;
+
+describe('Comment integration tests', () => {
+ const path = 'comment.md';
+
+ afterEach(async () => {
+ try {
+ await fs.unlink(path);
+ } catch (err) {}
+ });
+
+ test('cml send-comment to specific repo', async () => {
+ const {
+ TEST_GITHUB_REPO: repo,
+ TEST_GITHUB_TOKEN: token,
+ TEST_GITHUB_SHA: sha
+ } = process.env;
+
+ const report = `## Test Comment Report specific`;
+
+ await fs.writeFile(path, report);
+ await exec(
+ `node ./bin/cml.js send-comment --repo=${repo} --token=${token} --commit-sha=${sha} ${path}`
+ );
+ });
+
+ test('cml send-comment to current repo', async () => {
+ const report = `## Test Comment`;
+
+ await fs.writeFile(path, report);
+ await exec(`node ./bin/cml.js send-comment ${path}`);
+ });
+
+ test('cml send-comment --publish to current repo', async () => {
+ const report = `## Test Comment\n![](assets/logo.png)`;
+
+ await fs.writeFile(path, report);
+ await exec(`node ./bin/cml.js send-comment --publish ${path}`);
+ });
+});
diff --git a/bin/cml/comment/create.test.js b/bin/cml/comment/create.test.js
index feb06e944..a7a8a28ec 100644
--- a/bin/cml/comment/create.test.js
+++ b/bin/cml/comment/create.test.js
@@ -1,15 +1,6 @@
const { exec } = require('../../../src/utils');
-const fs = require('fs').promises;
describe('Comment integration tests', () => {
- const path = 'comment.md';
-
- afterEach(async () => {
- try {
- await fs.unlink(path);
- } catch (err) {}
- });
-
test('cml send-comment --help', async () => {
const output = await exec(`node ./bin/cml.js send-comment --help`);
@@ -44,33 +35,4 @@ describe('Comment integration tests', () => {
distinguish CML comments from others [boolean]"
`);
});
-
- test('cml send-comment to specific repo', async () => {
- const {
- TEST_GITHUB_REPO: repo,
- TEST_GITHUB_TOKEN: token,
- TEST_GITHUB_SHA: sha
- } = process.env;
-
- const report = `## Test Comment Report specific`;
-
- await fs.writeFile(path, report);
- await exec(
- `node ./bin/cml.js send-comment --repo=${repo} --token=${token} --commit-sha=${sha} ${path}`
- );
- });
-
- test('cml send-comment to current repo', async () => {
- const report = `## Test Comment`;
-
- await fs.writeFile(path, report);
- await exec(`node ./bin/cml.js send-comment ${path}`);
- });
-
- test('cml send-comment --publish to current repo', async () => {
- const report = `## Test Comment\n![](assets/logo.png)`;
-
- await fs.writeFile(path, report);
- await exec(`node ./bin/cml.js send-comment --publish ${path}`);
- });
});
diff --git a/bin/cml/pr/create.test.js b/bin/cml/pr/create.e2e.test.js
similarity index 100%
rename from bin/cml/pr/create.test.js
rename to bin/cml/pr/create.e2e.test.js
diff --git a/bin/cml/runner/launch.e2e.test.js b/bin/cml/runner/launch.e2e.test.js
new file mode 100644
index 000000000..5f4c9f4aa
--- /dev/null
+++ b/bin/cml/runner/launch.e2e.test.js
@@ -0,0 +1,130 @@
+jest.setTimeout(2000000);
+
+const isIp = require('is-ip');
+const { CML } = require('../../../src/cml');
+const { exec, sshConnection, randid, sleep } = require('../../../src/utils');
+
+const IDLE_TIMEOUT = 15;
+const {
+ TEST_GITHUB_TOKEN,
+ TEST_GITHUB_REPO,
+ TEST_GITLAB_TOKEN,
+ TEST_GITLAB_REPO,
+ SSH_PRIVATE
+} = process.env;
+
+const launchRunner = async (opts) => {
+ const { cloud, type, repo, token, privateKey, name } = opts;
+ const command = `node ./bin/cml.js runner --cloud ${cloud} --cloud-type ${type} --repo ${repo} --token ${token} --cloud-ssh-private="${privateKey}" --name ${name} --cloud-spot true --idle-timeout ${IDLE_TIMEOUT}`;
+
+ const output = await exec(command);
+ const state = JSON.parse(output.split(/\n/).pop());
+
+ return state;
+};
+
+const testRunner = async (opts) => {
+ const { repo, token, name, privateKey } = opts;
+ const { instanceIp: host } = await launchRunner(opts);
+ expect(isIp(host)).toBe(true);
+
+ const sshOpts = { host, username: 'ubuntu', privateKey };
+ const cml = new CML({ repo, token });
+
+ let runner = await cml.runnerByName({ name });
+ expect(runner).not.toBe(undefined);
+ await sshConnection(sshOpts);
+
+ await sleep(IDLE_TIMEOUT + 60);
+
+ runner = await cml.runnerByName({ name });
+ expect(runner).toBe(undefined);
+
+ let sshErr;
+ try {
+ await sshConnection(sshOpts);
+ } catch (err) {
+ sshErr = err;
+ }
+ expect(sshErr).not.toBe(undefined);
+};
+
+describe('CML e2e', () => {
+ test.skip('cml-runner GL/AWS', async () => {
+ const opts = {
+ repo: TEST_GITLAB_REPO,
+ token: TEST_GITLAB_TOKEN,
+ privateKey: SSH_PRIVATE,
+ cloud: 'aws',
+ type: 't2.micro',
+ name: `cml-test-${randid()}`
+ };
+
+ await testRunner(opts);
+ });
+
+ test.skip('cml-runner GH/AWS', async () => {
+ const opts = {
+ repo: TEST_GITHUB_REPO,
+ token: TEST_GITHUB_TOKEN,
+ privateKey: SSH_PRIVATE,
+ cloud: 'aws',
+ type: 't2.micro',
+ name: `cml-test-${randid()}`
+ };
+
+ await testRunner(opts);
+ });
+
+ test.skip('cml-runner GL/Azure', async () => {
+ const opts = {
+ repo: TEST_GITLAB_REPO,
+ token: TEST_GITLAB_TOKEN,
+ privateKey: SSH_PRIVATE,
+ cloud: 'azure',
+ type: 'm',
+ name: `cml-test-${randid()}`
+ };
+
+ await testRunner(opts);
+ });
+
+ test.skip('cml-runner GH/Azure', async () => {
+ const opts = {
+ repo: TEST_GITHUB_REPO,
+ token: TEST_GITHUB_TOKEN,
+ privateKey: SSH_PRIVATE,
+ cloud: 'azure',
+ type: 'm',
+ name: `cml-test-${randid()}`
+ };
+
+ await testRunner(opts);
+ });
+
+ test.skip('cml-runner GL/GCP', async () => {
+ const opts = {
+ repo: TEST_GITLAB_REPO,
+ token: TEST_GITLAB_TOKEN,
+ privateKey: SSH_PRIVATE,
+ cloud: 'gcp',
+ type: 'm',
+ name: `cml-test-${randid()}`
+ };
+
+ await testRunner(opts);
+ });
+
+ test.skip('cml-runner GH/GCP', async () => {
+ const opts = {
+ repo: TEST_GITHUB_REPO,
+ token: TEST_GITHUB_TOKEN,
+ privateKey: SSH_PRIVATE,
+ cloud: 'gcp',
+ type: 'm',
+ name: `cml-test-${randid()}`
+ };
+
+ await testRunner(opts);
+ });
+});
diff --git a/bin/cml/runner/launch.test.js b/bin/cml/runner/launch.test.js
index 12a970b18..9dd29db73 100644
--- a/bin/cml/runner/launch.test.js
+++ b/bin/cml/runner/launch.test.js
@@ -1,53 +1,4 @@
-jest.setTimeout(2000000);
-
-const isIp = require('is-ip');
-const { CML } = require('../../../src/cml');
-const { exec, sshConnection, randid, sleep } = require('../../../src/utils');
-
-const IDLE_TIMEOUT = 15;
-const {
- TEST_GITHUB_TOKEN,
- TEST_GITHUB_REPO,
- TEST_GITLAB_TOKEN,
- TEST_GITLAB_REPO,
- SSH_PRIVATE
-} = process.env;
-
-const launchRunner = async (opts) => {
- const { cloud, type, repo, token, privateKey, name } = opts;
- const command = `node ./bin/cml.js runner --cloud ${cloud} --cloud-type ${type} --repo ${repo} --token ${token} --cloud-ssh-private="${privateKey}" --name ${name} --cloud-spot true --idle-timeout ${IDLE_TIMEOUT}`;
-
- const output = await exec(command);
- const state = JSON.parse(output.split(/\n/).pop());
-
- return state;
-};
-
-const testRunner = async (opts) => {
- const { repo, token, name, privateKey } = opts;
- const { instanceIp: host } = await launchRunner(opts);
- expect(isIp(host)).toBe(true);
-
- const sshOpts = { host, username: 'ubuntu', privateKey };
- const cml = new CML({ repo, token });
-
- let runner = await cml.runnerByName({ name });
- expect(runner).not.toBe(undefined);
- await sshConnection(sshOpts);
-
- await sleep(IDLE_TIMEOUT + 60);
-
- runner = await cml.runnerByName({ name });
- expect(runner).toBe(undefined);
-
- let sshErr;
- try {
- await sshConnection(sshOpts);
- } catch (err) {
- sshErr = err;
- }
- expect(sshErr).not.toBe(undefined);
-};
+const { exec } = require('../../../src/utils');
describe('CML e2e', () => {
test('cml-runner --help', async () => {
@@ -72,82 +23,4 @@ describe('CML e2e', () => {
--help Show help [boolean]"
`);
});
-
- test.skip('cml-runner GL/AWS', async () => {
- const opts = {
- repo: TEST_GITLAB_REPO,
- token: TEST_GITLAB_TOKEN,
- privateKey: SSH_PRIVATE,
- cloud: 'aws',
- type: 't2.micro',
- name: `cml-test-${randid()}`
- };
-
- await testRunner(opts);
- });
-
- test.skip('cml-runner GH/AWS', async () => {
- const opts = {
- repo: TEST_GITHUB_REPO,
- token: TEST_GITHUB_TOKEN,
- privateKey: SSH_PRIVATE,
- cloud: 'aws',
- type: 't2.micro',
- name: `cml-test-${randid()}`
- };
-
- await testRunner(opts);
- });
-
- test.skip('cml-runner GL/Azure', async () => {
- const opts = {
- repo: TEST_GITLAB_REPO,
- token: TEST_GITLAB_TOKEN,
- privateKey: SSH_PRIVATE,
- cloud: 'azure',
- type: 'm',
- name: `cml-test-${randid()}`
- };
-
- await testRunner(opts);
- });
-
- test.skip('cml-runner GH/Azure', async () => {
- const opts = {
- repo: TEST_GITHUB_REPO,
- token: TEST_GITHUB_TOKEN,
- privateKey: SSH_PRIVATE,
- cloud: 'azure',
- type: 'm',
- name: `cml-test-${randid()}`
- };
-
- await testRunner(opts);
- });
-
- test.skip('cml-runner GL/GCP', async () => {
- const opts = {
- repo: TEST_GITLAB_REPO,
- token: TEST_GITLAB_TOKEN,
- privateKey: SSH_PRIVATE,
- cloud: 'gcp',
- type: 'm',
- name: `cml-test-${randid()}`
- };
-
- await testRunner(opts);
- });
-
- test.skip('cml-runner GH/GCP', async () => {
- const opts = {
- repo: TEST_GITHUB_REPO,
- token: TEST_GITHUB_TOKEN,
- privateKey: SSH_PRIVATE,
- cloud: 'gcp',
- type: 'm',
- name: `cml-test-${randid()}`
- };
-
- await testRunner(opts);
- });
});
diff --git a/bin/cml/tensorboard/connect.e2e.test.js b/bin/cml/tensorboard/connect.e2e.test.js
new file mode 100644
index 000000000..f4dec0840
--- /dev/null
+++ b/bin/cml/tensorboard/connect.e2e.test.js
@@ -0,0 +1,79 @@
+const fs = require('fs').promises;
+const tempy = require('tempy');
+const { exec, isProcRunning, sleep } = require('../../../src/utils');
+const { tbLink } = require('./connect');
+
+const CREDENTIALS =
+ '{"refresh_token": "1//03FiVnGk2xhnNCgYIARAAGAMSNwF-L9IrPH8FOOVWEYUihFDToqxyLArxfnbKFmxEfhzys_KYVVzBisYlAy225w4HaX3ais5TV_Q", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "373649185512-8v619h5kft38l4456nm2dj4ubeqsrvh6.apps.googleusercontent.com", "client_secret": "pOyAuU2yq2arsM98Bw5hwYtr", "scopes": ["openid", "https://www.googleapis.com/auth/userinfo.email"], "type": "authorized_user"}';
+
+const isTbRunning = async () => {
+ await sleep(2);
+ const isRunning = await isProcRunning({ name: 'tensorboard' });
+
+ return isRunning;
+};
+
+const rmTbDevExperiment = async (tbOutput) => {
+ const id = /experiment\/([a-zA-Z0-9]{22})/.exec(tbOutput)[1];
+ await exec(`tensorboard dev delete --experiment_id ${id}`);
+};
+
+describe('tbLink', () => {
+ test('timeout without result throws exception', async () => {
+ const stdout = tempy.file({ extension: 'log' });
+ const stderror = tempy.file({ extension: 'log' });
+ const message = 'there is an error';
+ let error;
+
+ await fs.writeFile(stdout, 'nothing');
+ await fs.writeFile(stderror, message);
+
+ try {
+ await tbLink({ stdout, stderror, timeout: 5 });
+ } catch (err) {
+ error = err;
+ }
+
+ expect(error.message).toBe(`Tensorboard took too long. ${message}`);
+ });
+
+ test('valid url is returned', async () => {
+ const stdout = tempy.file({ extension: 'log' });
+ const stderror = tempy.file({ extension: 'log' });
+ const message = 'https://iterative.ai';
+
+ await fs.writeFile(stdout, message);
+ await fs.writeFile(stderror, '');
+
+ const link = await tbLink({ stderror, stdout, timeout: 5 });
+ expect(link).toBe(`${message}/?cml=tb`);
+ });
+});
+
+describe('CML e2e', () => {
+ test('cml tensorboard-dev --md returns md and after command TB is still up', async () => {
+ const name = 'My experiment';
+ const desc = 'Test experiment';
+ const title = 'go to the experiment';
+ const output = await exec(
+ `node ./bin/cml.js tensorboard-dev --credentials '${CREDENTIALS}' \
+ --md --title '${title}' \
+ --logdir logs --name '${name}' --description '${desc}'`
+ );
+
+ const isRunning = await isTbRunning();
+ await rmTbDevExperiment(output);
+
+ expect(isRunning).toBe(true);
+ expect(output.startsWith(`[${title}](https://`)).toBe(true);
+ expect(output.includes('cml=tb')).toBe(true);
+ });
+
+ test('cml tensorboard-dev invalid creds', async () => {
+ try {
+ await exec(`node ./bin/cml.js tensorboard-dev --credentials 'invalid'`);
+ } catch (err) {
+ expect(err.message.includes('json.decoder.JSONDecodeError')).toBe(true);
+ }
+ });
+});
diff --git a/bin/cml/tensorboard/connect.test.js b/bin/cml/tensorboard/connect.test.js
index fd9fa83b5..b6d23f9d1 100644
--- a/bin/cml/tensorboard/connect.test.js
+++ b/bin/cml/tensorboard/connect.test.js
@@ -1,54 +1,4 @@
-const fs = require('fs').promises;
-const tempy = require('tempy');
-const { exec, isProcRunning, sleep } = require('../../../src/utils');
-const { tbLink } = require('./connect');
-
-const CREDENTIALS =
- '{"refresh_token": "1//03FiVnGk2xhnNCgYIARAAGAMSNwF-L9IrPH8FOOVWEYUihFDToqxyLArxfnbKFmxEfhzys_KYVVzBisYlAy225w4HaX3ais5TV_Q", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "373649185512-8v619h5kft38l4456nm2dj4ubeqsrvh6.apps.googleusercontent.com", "client_secret": "pOyAuU2yq2arsM98Bw5hwYtr", "scopes": ["openid", "https://www.googleapis.com/auth/userinfo.email"], "type": "authorized_user"}';
-
-const isTbRunning = async () => {
- await sleep(2);
- const isRunning = await isProcRunning({ name: 'tensorboard' });
-
- return isRunning;
-};
-
-const rmTbDevExperiment = async (tbOutput) => {
- const id = /experiment\/([a-zA-Z0-9]{22})/.exec(tbOutput)[1];
- await exec(`tensorboard dev delete --experiment_id ${id}`);
-};
-
-describe('tbLink', () => {
- test('timeout without result throws exception', async () => {
- const stdout = tempy.file({ extension: 'log' });
- const stderror = tempy.file({ extension: 'log' });
- const message = 'there is an error';
- let error;
-
- await fs.writeFile(stdout, 'nothing');
- await fs.writeFile(stderror, message);
-
- try {
- await tbLink({ stdout, stderror, timeout: 5 });
- } catch (err) {
- error = err;
- }
-
- expect(error.message).toBe(`Tensorboard took too long. ${message}`);
- });
-
- test('valid url is returned', async () => {
- const stdout = tempy.file({ extension: 'log' });
- const stderror = tempy.file({ extension: 'log' });
- const message = 'https://iterative.ai';
-
- await fs.writeFile(stdout, message);
- await fs.writeFile(stderror, '');
-
- const link = await tbLink({ stderror, stdout, timeout: 5 });
- expect(link).toBe(`${message}/?cml=tb`);
- });
-});
+const { exec } = require('../../../src/utils');
describe('CML e2e', () => {
test('cml tensorboard-dev --help', async () => {
@@ -83,30 +33,4 @@ describe('CML e2e', () => {
--rm-watermark Avoid CML watermark [boolean]"
`);
});
-
- test('cml tensorboard-dev --md returns md and after command TB is still up', async () => {
- const name = 'My experiment';
- const desc = 'Test experiment';
- const title = 'go to the experiment';
- const output = await exec(
- `node ./bin/cml.js tensorboard-dev --credentials '${CREDENTIALS}' \
- --md --title '${title}' \
- --logdir logs --name '${name}' --description '${desc}'`
- );
-
- const isRunning = await isTbRunning();
- await rmTbDevExperiment(output);
-
- expect(isRunning).toBe(true);
- expect(output.startsWith(`[${title}](https://`)).toBe(true);
- expect(output.includes('cml=tb')).toBe(true);
- });
-
- test('cml tensorboard-dev invalid creds', async () => {
- try {
- await exec(`node ./bin/cml.js tensorboard-dev --credentials 'invalid'`);
- } catch (err) {
- expect(err.message.includes('json.decoder.JSONDecodeError')).toBe(true);
- }
- });
});
diff --git a/bin/legacy/link.test.js b/bin/legacy/link.e2e.test.js
similarity index 100%
rename from bin/legacy/link.test.js
rename to bin/legacy/link.e2e.test.js
diff --git a/package.json b/package.json
index 13ea8c600..39853c0c8 100644
--- a/package.json
+++ b/package.json
@@ -45,6 +45,8 @@
"lintfix": "eslint --fix ./ && prettier --write '**/*.{js,json,md,yaml,yml}'",
"lint": "eslint ./",
"test": "jest --forceExit",
+ "test:unit": "jest --testPathIgnorePatterns='e2e.test.js$' --forceExit",
+ "test:e2e": "jest --testNamePattern='e2e.test.js$' --forceExit",
"do_snapshots": "jest --updateSnapshot"
},
"husky": {
@@ -122,7 +124,8 @@
"jest": {
"globalSetup": "./tests/setup.js",
"globalTeardown": "./tests/teardown.js",
- "testTimeout": 600000
+ "testTimeout": 600000,
+ "collectCoverage": true
},
"pkg": {
"bin": "bin/cml.js",
diff --git a/src/analytics.test.js b/src/analytics.e2e.test.js
similarity index 100%
rename from src/analytics.test.js
rename to src/analytics.e2e.test.js
diff --git a/src/cml.test.js b/src/cml.e2e.test.js
similarity index 100%
rename from src/cml.test.js
rename to src/cml.e2e.test.js
diff --git a/src/drivers/bitbucket_cloud.test.js b/src/drivers/bitbucket_cloud.e2e.test.js
similarity index 100%
rename from src/drivers/bitbucket_cloud.test.js
rename to src/drivers/bitbucket_cloud.e2e.test.js
diff --git a/src/drivers/github.test.js b/src/drivers/github.e2e.test.js
similarity index 100%
rename from src/drivers/github.test.js
rename to src/drivers/github.e2e.test.js
diff --git a/src/drivers/gitlab.test.js b/src/drivers/gitlab.e2e.test.js
similarity index 100%
rename from src/drivers/gitlab.test.js
rename to src/drivers/gitlab.e2e.test.js
From fe9a06f2009d7bc1bc2327d637c68e9810a1e5e1 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Sat, 8 Oct 2022 01:02:08 +0200
Subject: [PATCH 06/14] Enable `cml comment create --publish` by default
(#1208)
* Enable `cml comment create --publish` by default
* Fix test
---
bin/cml/comment/create.js | 1 +
bin/cml/comment/create.test.js | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/bin/cml/comment/create.js b/bin/cml/comment/create.js
index 59ea2a60d..8036dca6f 100644
--- a/bin/cml/comment/create.js
+++ b/bin/cml/comment/create.js
@@ -24,6 +24,7 @@ exports.options = kebabcaseKeys({
},
publish: {
type: 'boolean',
+ default: true,
description: 'Upload any local images found in the Markdown report'
},
publishUrl: {
diff --git a/bin/cml/comment/create.test.js b/bin/cml/comment/create.test.js
index a7a8a28ec..e9245a437 100644
--- a/bin/cml/comment/create.test.js
+++ b/bin/cml/comment/create.test.js
@@ -23,7 +23,7 @@ describe('Comment integration tests', () => {
--commit-sha, --head-sha Commit SHA linked to this comment
[string] [default: \\"HEAD\\"]
--publish Upload any local images found in the Markdown report
- [boolean]
+ [boolean] [default: true]
--publish-url Self-hosted image server URL
[string] [default: \\"https://asset.cml.dev\\"]
--watch Watch for changes and automatically update the
From b1707f3e66b823f67f60c315cbed53510fe6ba2b Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Sat, 8 Oct 2022 06:28:40 +0200
Subject: [PATCH 07/14] Fix release workflows, again (#1214)
* Use fallback false value on test-deploy workflow
* Replace `softprops/action-gh-release` with `gh`
---
.github/workflows/test-deploy.yml | 38 ++++++++-----------------------
package-lock.json | 4 ++--
package.json | 2 +-
3 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml
index 05333b1ef..6f4fb3434 100644
--- a/.github/workflows/test-deploy.yml
+++ b/.github/workflows/test-deploy.yml
@@ -102,42 +102,24 @@ jobs:
registry-url: https://registry.npmjs.org
- run: npm install
- run:
- npm ${{ inputs.release && 'publish' || 'publish --dry-run' }}
+ npm ${{ inputs.release && 'publish' || 'publish --dry-run' }} || ${{
+ inputs.release && 'true' || 'false' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- - name: install ldid
- run: |
+ - run: |
sudo apt install --yes libplist-dev
git clone --branch v2.1.5 git://git.saurik.com/ldid.git
sudo g++ -pipe -o /usr/bin/ldid ldid/ldid.cpp -I. -x c ldid/{lookup2.c,sha1.h} -lplist -lcrypto
- - id: build
- name: build
- run: |
- echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
+ - run: |
cp node_modules/@npcz/magic/dist/magic.mgc assets/magic.mgc
npx --yes pkg --no-bytecode --public-packages "*" --public package.json
- rm assets/magic.mgc
- for cmd in '' runner publish pr; do
- build/cml-linux-x64 $cmd --version
- done
+ for cmd in '' runner publish pr; do build/cml-linux-x64 $cmd --version; done
cp build/cml-linux{-x64,}
cp build/cml-macos{-x64,}
- - uses: softprops/action-gh-release@v1
- if: inputs.release
- with:
- files: |
- build/cml-alpine-arm64
- build/cml-alpine-x64
- build/cml-linux-arm64
- build/cml-linuxstatic-arm64
- build/cml-linuxstatic-x64
- build/cml-linux-x64
- build/cml-linux
- build/cml-macos-arm64
- build/cml-macos-x64
- build/cml-macos
- build/cml-win-arm64.exe
- build/cml-win-x64.exe
+ - if: inputs.release
+ run:
+ find build -type f | xargs gh release upload $(basename ${{
+ github.head_ref }})
env:
GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
images:
@@ -145,4 +127,4 @@ jobs:
secrets: inherit
uses: ./.github/workflows/images.yml
with:
- release: ${{ inputs.release }}
+ release: ${{ inputs.release || false }}
diff --git a/package-lock.json b/package-lock.json
index 0068608d3..a0ab015f4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.1",
+ "version": "0.18.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dvcorg/cml",
- "version": "0.18.1",
+ "version": "0.18.0",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.9.1",
diff --git a/package.json b/package.json
index 39853c0c8..1b37f4033 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.1",
+ "version": "0.18.0",
"description": "
",
"author": {
"name": "Iterative Inc",
From 2b47d0c6b4b18f93488c8561cb2178adcc8dd941 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Sat, 8 Oct 2022 06:34:28 +0200
Subject: [PATCH 08/14] Fast-forward version number to v0.18.3 (#1215)
18.0.3
---
.github/workflows/test-deploy.yml | 4 +---
package-lock.json | 4 ++--
package.json | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml
index 6f4fb3434..e3fb49862 100644
--- a/.github/workflows/test-deploy.yml
+++ b/.github/workflows/test-deploy.yml
@@ -101,9 +101,7 @@ jobs:
with:
registry-url: https://registry.npmjs.org
- run: npm install
- - run:
- npm ${{ inputs.release && 'publish' || 'publish --dry-run' }} || ${{
- inputs.release && 'true' || 'false' }}
+ - run: npm ${{ inputs.release && 'publish' || 'publish --dry-run' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: |
diff --git a/package-lock.json b/package-lock.json
index a0ab015f4..3364c9edb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.0",
+ "version": "18.0.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dvcorg/cml",
- "version": "0.18.0",
+ "version": "18.0.3",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.9.1",
diff --git a/package.json b/package.json
index 1b37f4033..ad7623eb7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.0",
+ "version": "18.0.3",
"description": "
",
"author": {
"name": "Iterative Inc",
From c83044eec0cfae6dfc0d96d1cf714ebe2565680b Mon Sep 17 00:00:00 2001
From: "Olivaw[bot]" <64868532+iterative-olivaw@users.noreply.github.com>
Date: Sat, 8 Oct 2022 06:43:13 +0200
Subject: [PATCH 09/14] 18.0.4 (#1216)
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 3364c9edb..f03f441a3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@dvcorg/cml",
- "version": "18.0.3",
+ "version": "18.0.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dvcorg/cml",
- "version": "18.0.3",
+ "version": "18.0.4",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.9.1",
diff --git a/package.json b/package.json
index ad7623eb7..0ba606977 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
- "version": "18.0.3",
+ "version": "18.0.4",
"description": "
",
"author": {
"name": "Iterative Inc",
From c97e5481fb91932dc137da94de0a189d54bdc694 Mon Sep 17 00:00:00 2001
From: Daniel Barnes
Date: Sat, 8 Oct 2022 15:07:48 -0700
Subject: [PATCH 10/14] CodeQL recommendations (#1218)
* url parsing based on codeql results
* Update src/drivers/github.js
* debug
* lazy debugging
* bad ternary?
* lazy debugging
* Revert things
This reverts commit df90c98f220d7bad08a4313277bc77ec8a08401a.
This reverts commit f11c8ae959cf73276bc07c5a641b2c5eab5d2bdd.
This reverts commit 39d0a456180be3908d15b899b1c946fb3b1e5d13.
* Cleanup
---
bin/cml/asset/publish.js | 4 ++--
src/cml.js | 7 ++++---
src/drivers/github.js | 5 ++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/bin/cml/asset/publish.js b/bin/cml/asset/publish.js
index 208deb2cd..d545c0fe2 100644
--- a/bin/cml/asset/publish.js
+++ b/bin/cml/asset/publish.js
@@ -15,8 +15,8 @@ exports.handler = async (opts) => {
opts.native = true;
}
- const { file, repo, native, asset: path } = opts;
- const cml = new CML({ ...opts, repo: native ? repo : 'cml' });
+ const { file, asset: path } = opts;
+ const cml = new CML({ ...opts });
const output = await cml.publish({ ...opts, path });
if (!file) console.log(output);
diff --git a/src/cml.js b/src/cml.js
index 8a755e26b..b303942d8 100755
--- a/src/cml.js
+++ b/src/cml.js
@@ -69,9 +69,10 @@ const inferToken = () => {
const inferDriver = (opts = {}) => {
const { repo } = opts;
if (repo) {
- if (repo.includes('github.com')) return GITHUB;
- if (repo.includes('gitlab.com')) return GITLAB;
- if (/bitbucket\.(com|org)/.test(repo)) return BB;
+ const url = new URL(repo);
+ if (url.hostname === 'github.com') return GITHUB;
+ if (url.hostname === 'gitlab.com') return GITLAB;
+ if (/bitbucket\.(com|org)/.test(url.hostname)) return BB;
}
if (GITHUB_REPOSITORY) return GITHUB;
diff --git a/src/drivers/github.js b/src/drivers/github.js
index a4ab4fd81..5362f59e5 100644
--- a/src/drivers/github.js
+++ b/src/drivers/github.js
@@ -66,11 +66,10 @@ const octokit = (token, repo) => {
onAbuseLimit: throttleHandler
}
};
-
- if (!repo.includes('github.com')) {
+ const { host, hostname } = new url.URL(repo);
+ if (hostname !== 'github.com') {
// GitHub Enterprise, use the: repo URL host + '/api/v3' - as baseURL
// as per: https://developer.github.com/enterprise/v3/enterprise-admin/#endpoint-urls
- const { host } = new url.URL(repo);
octokitOptions.baseUrl = `https://${host}/api/v3`;
}
From c9ecc0c63ca4d6ea79c6ec55f753f933c1c4202f Mon Sep 17 00:00:00 2001
From: Vedant Pandya
Date: Sun, 9 Oct 2022 03:47:11 +0530
Subject: [PATCH 11/14] Create codeql-analysis.yml (#1096)
* Create codeql-analysis.yml
* Update .github/workflows/codeql-analysis.yml
Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com>
Co-authored-by: Daniel Barnes
---
.github/workflows/codeql-analysis.yml | 29 +++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 .github/workflows/codeql-analysis.yml
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
new file mode 100644
index 000000000..a5cbd1b2e
--- /dev/null
+++ b/.github/workflows/codeql-analysis.yml
@@ -0,0 +1,29 @@
+name: CodeQL
+
+on:
+ pull_request:
+ paths-ignore:
+ - '**.md'
+ - assets/**
+ schedule:
+ - cron: '0 0 * * *' # everyday @ 0000 UTC
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref_name }}
+ cancel-in-progress: true
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+ steps:
+ - uses: actions/checkout@v3
+ - uses: github/codeql-action/init@v2
+ with:
+ languages: javascript
+ - uses: github/codeql-action/autobuild@v2
+ - uses: github/codeql-action/analyze@v2
From e9546a2ccc596cedc34173e2267af1e23a35394c Mon Sep 17 00:00:00 2001
From: Casper da Costa-Luis
Date: Mon, 10 Oct 2022 04:35:22 +0100
Subject: [PATCH 12/14] fix driver detection (#1209)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* fix driver detection
- fixes #1066
* remove unneeded variable
* 🤖
Co-authored-by: Daniel Barnes
Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com>
---
bin/cml/runner/launch.js | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/bin/cml/runner/launch.js b/bin/cml/runner/launch.js
index 669db00b2..8b568db12 100755
--- a/bin/cml/runner/launch.js
+++ b/bin/cml/runner/launch.js
@@ -338,16 +338,8 @@ const run = async (opts) => {
process.on(signal, () => shutdown({ ...opts, reason: signal }));
});
- const {
- driver,
- workdir,
- cloud,
- labels,
- name,
- reuse,
- reuseIdle,
- dockerVolumes
- } = opts;
+ const { workdir, cloud, labels, name, reuse, reuseIdle, dockerVolumes } =
+ opts;
await cml.repoTokenCheck();
@@ -375,7 +367,7 @@ const run = async (opts) => {
}
if (reuseIdle) {
- if (driver === 'bitbucket') {
+ if (cml.driver === 'bitbucket') {
throw new Error(
'cml runner flag --reuse-idle is unsupported by bitbucket'
);
@@ -396,7 +388,7 @@ const run = async (opts) => {
if (dockerVolumes.length && cml.driver !== 'gitlab')
winston.warn('Parameters --docker-volumes is only supported in gitlab');
- if (driver === 'github')
+ if (cml.driver === 'github')
winston.warn(
'Github Actions timeout has been updated from 72h to 35 days. Update your workflow accordingly to be able to restart it automatically.'
);
From 35d137d1dffec620f37bd70e96644bb30141e14c Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Tue, 11 Oct 2022 17:18:21 +0200
Subject: [PATCH 13/14] 0.18.5 (#1220)
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index f03f441a3..e7926f321 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@dvcorg/cml",
- "version": "18.0.4",
+ "version": "0.18.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dvcorg/cml",
- "version": "18.0.4",
+ "version": "0.18.4",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.9.1",
diff --git a/package.json b/package.json
index 0ba606977..229f2f4a4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
- "version": "18.0.4",
+ "version": "0.18.4",
"description": "
",
"author": {
"name": "Iterative Inc",
From c1ec211b4bec618ff0aba9230f38e9588ed1e4d3 Mon Sep 17 00:00:00 2001
From: "Olivaw[bot]" <64868532+iterative-olivaw@users.noreply.github.com>
Date: Tue, 11 Oct 2022 17:24:39 +0200
Subject: [PATCH 14/14] 0.18.5 (#1221)
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index e7926f321..b12751de9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.4",
+ "version": "0.18.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dvcorg/cml",
- "version": "0.18.4",
+ "version": "0.18.5",
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.9.1",
diff --git a/package.json b/package.json
index 229f2f4a4..73d2b48ec 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
- "version": "0.18.4",
+ "version": "0.18.5",
"description": "
",
"author": {
"name": "Iterative Inc",