Skip to content

Commit

Permalink
license check workflow added (#8206)
Browse files Browse the repository at this point in the history
<!--
Thank you for your contribution.

Before making a PR, please read our contributing guidelines at

https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution

We recommend creating a *draft* PR, so that you can mark it as 'ready
for review' when you are done.
-->

## Purpose
Add a workflow to check production dependencies licenses.

## Approach
Create a new workflow file and add it in artifacts deploy

## References
Correct licenses run:
https://github.com/Testing-and-Learning/testcafe/actions/runs/9413544636
Incorrect licenses run:
https://github.com/Testing-and-Learning/testcafe/actions/runs/9413057523/job/25929056940

## Pre-Merge TODO
- [ ] Write tests for your proposed changes
- [ ] Make sure that existing tests do not fail

---------

Co-authored-by: Bayheck <[email protected]>
  • Loading branch information
Bayheck and Bayheck authored Jun 11, 2024
1 parent f428928 commit 1842e2c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/deploy-to-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ jobs:
tasks.push('test-server-docker.yml');
tasks.push('test-server-minimal.yml');
tasks.push('test-server-latest.yml');
tasks.push('license-check.yml');
await Promise.all(tasks.map(task => dispatchWorkflow(task)));
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check Licenses

on:
workflow_dispatch:
inputs:
sha:
description: "The test commit SHA or ref"
required: true
default: "master"
merged_sha:
description: "The merge commit SHA"
deploy_run_id:
description: "The ID of a deployment workspace run with artifacts"

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: latest

- name: Install dependencies
run: npm install

- name: Run Gulp build
run: npx gulp build

- name: Pack the application
run: npm pack

- name: Install the application and check licenses
run: mkdir temp && cd temp && npm init -y && npm install ../*.tgz && npx gulp check-licenses
2 changes: 1 addition & 1 deletion test/dependency-licenses-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const INCOMPATIBLE_LICENSES_RE = /GPL/i;
const hasIncompatibleLicenses = license => INCOMPATIBLE_LICENSES_RE.test(license);
const hasUnknownLicenses = license => PERMISSIVE_LICENSES.indexOf(license) === -1;

const modulePath = path.join(__dirname, '../');
const modulePath = path.join(__dirname, '../temp');

function checkLicense (license, module) {
const unknownModuleAssertionMsg = `The module '${module}' contains an unknown license '${license}'. You can add this license to the list of known permissive licenses. But be cautious and do this only if you are sure that this license is compatible with TestCafe`;
Expand Down

0 comments on commit 1842e2c

Please sign in to comment.