Skip to content

Commit

Permalink
Merge branch 'master' into fix-driver
Browse files Browse the repository at this point in the history
  • Loading branch information
dacbd authored Oct 8, 2022
2 parents 7467d12 + c9ecc0c commit 5f4a9da
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 41 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/codeql-analysis.yml
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
38 changes: 9 additions & 29 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,48 +101,28 @@ jobs:
with:
registry-url: https://registry.npmjs.org
- run: npm install
- run:
npm ${{ inputs.release && 'publish' || 'publish --dry-run' }}
- run: npm ${{ inputs.release && 'publish' || 'publish --dry-run' }}
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:
needs: packages
secrets: inherit
uses: ./.github/workflows/images.yml
with:
release: ${{ inputs.release }}
release: ${{ inputs.release || false }}
4 changes: 2 additions & 2 deletions bin/cml/asset/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions bin/cml/comment/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ exports.options = kebabcaseKeys({
},
publish: {
type: 'boolean',
default: true,
description: 'Upload any local images found in the Markdown report'
},
publishUrl: {
Expand Down
2 changes: 1 addition & 1 deletion bin/cml/comment/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
"version": "0.18.1",
"version": "18.0.4",
"description": "<p align=\"center\"> <img src=\"https://static.iterative.ai/img/cml/title_strip_trim.png\" width=400> </p>",
"author": {
"name": "Iterative Inc",
Expand Down
7 changes: 4 additions & 3 deletions src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/drivers/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}

Expand Down

2 comments on commit 5f4a9da

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

Please sign in to comment.