-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into enrich-analytics
- Loading branch information
Showing
30 changed files
with
472 additions
and
417 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
git config --global user.name Olivaw[bot] | ||
git config --global user.email [email protected] | ||
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,15 @@ 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 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ terraform.* | |
!terraform.test.js | ||
crash.log | ||
/build | ||
/coverage |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); | ||
}); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}"` | ||
)); | ||
}); | ||
}); |
Oops, something went wrong.
16cf7e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Comment
16cf7e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Comment
16cf7e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Comment
16cf7e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Comment