-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (71 loc) · 2.4 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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 || exit 0
# 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