Add an option to ensure product references are correct #200
Workflow file for this run
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
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
timeout-minutes: 10 | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/[email protected] | |
- name: Setup Node.js for use with actions | |
uses: actions/[email protected] | |
with: | |
node-version-file: '.nvmrc' | |
- run: yarn install --frozen-lockfile | |
- run: yarn lint | |
- run: yarn build | |
- run: cargo build --release | |
working-directory: rust-crate-scanner | |
- run: yarn test | |
e2e: | |
timeout-minutes: 10 | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/[email protected] | |
with: | |
path: license-scanner | |
- name: Setup Node.js for use with actions | |
uses: actions/[email protected] | |
with: | |
node-version-file: 'license-scanner/.nvmrc' | |
- uses: actions/[email protected] | |
with: | |
repository: paritytech/polkadot | |
ref: '1c935f35139f3f43cb22009dc5c010dfbe6ad9e7' | |
path: polkadot | |
- run: yarn install --frozen-lockfile | |
working-directory: license-scanner | |
- name: Build and install globally | |
run: | | |
yarn build | |
npm i -g . | |
working-directory: license-scanner | |
- name: Scan the Polkadot repo - node directory | |
run: | | |
license-scanner scan --log-level debug ./node | |
working-directory: polkadot | |
# It should take a reasonable time to scan the node crate. | |
timeout-minutes: 3 | |
- name: Dump into csv | |
working-directory: polkadot | |
run: | | |
license-scanner dump $(realpath ./node) ./output.csv | |
# Check a couple of rows to make sure we have the output we expected. | |
grep -q '"metrics/src/lib.rs","GPL-3.0-only"' ./output.csv | |
grep -q '"overseer/src/tests.rs","GPL-3.0-only"' ./output.csv | |
- name: Enforce licenses in Rust files | |
run: | | |
shopt -s globstar | |
license-scanner scan \ | |
--ensure-licenses Apache-2.0 GPL-3.0-only \ | |
--exclude ./**/target ./**/weights \ | |
-- ./**/src/**/*.rs \ | |
2>out.txt \ | |
&& exit 1 || true | |
# We expected it to fail because there are some unlicensed files left. | |
grep -q 'No license detected in reconstruct.rs. Exact file path:' ./out.txt | |
grep -q 'No license detected in mod.rs. Exact file path:' ./out.txt | |
working-directory: polkadot | |
- name: Enforce product references in headers | |
run: | | |
license-scanner scan \ | |
--ensure-product 'Polkadot' \ | |
-- ./xcm/src/lib.rs \ | |
2>out.txt \ | |
&& exit 1 || true | |
# We expected it to fail because there are some copy-paste errors. | |
grep -q 'Product mismatch' ./out.txt | |
grep -q 'Expected "Polkadot", detected "Substrate" in line:' ./out.txt | |
working-directory: polkadot |