Skip to content

Commit 0a13f55

Browse files
committed
Add linter to CI
Also, pass all linters
1 parent fc18cee commit 0a13f55

File tree

7 files changed

+50
-6
lines changed

7 files changed

+50
-6
lines changed

.github/workflows/build.yml

+22
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@ on:
33
- push
44

55
jobs:
6+
rubocop:
7+
name: Lint (Rubocop)
8+
runs-on: ubuntu-20.04
9+
container: ruby:2.3
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Bundle
14+
run: bundle install
15+
- name: Rubocop
16+
run: bundle exec rubocop -f simple
17+
shellcheck:
18+
name: Lint (Shellcheck)
19+
runs-on: ubuntu-20.04
20+
container: debian:10
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
- name: Install shellcheck
25+
run: apt-get update && apt-get install -y shellcheck
26+
- name: Shellcheck
27+
run: shellcheck libexec/*
628
build-ruby:
729
name: Build (ruby)
830
runs-on: ubuntu-20.04

.rubocop.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
AllCops:
22
TargetRubyVersion: 2.0
33
Exclude:
4-
- src/**
4+
- src/**/*
5+
- pkg/**/*
6+
- vendor/**/*
7+
8+
Naming/FileName:
9+
Exclude:
10+
- lib/libv8-node.rb
511

612
Style/Documentation:
713
Enabled: false
@@ -14,3 +20,9 @@ Style/NumericPredicate:
1420

1521
Metrics/LineLength:
1622
Enabled: false
23+
24+
Style/WordArray:
25+
Enabled: false
26+
27+
Style/PerlBackrefs:
28+
Enabled: false

Rakefile

+8-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ namespace :binary do
5858
Helpers.binary_gemspec # loads NODE_VERSION
5959
major, minor = File.read(Dir["src/node-#{Libv8::Node::NODE_VERSION}/common.gypi"].last).lines.find { |l| l =~ /-mmacosx-version-min=(\d+).(\d+)/ } && [Integer($1), Integer($2)]
6060

61-
first = minor + 4 # macos 10.X => darwinY offset
62-
first = 20 if RUBY_PLATFORM =~ /^arm46/
63-
max = 20 # current known max
61+
first = if RUBY_PLATFORM =~ /\barm64e?-/
62+
20 # arm64 darwin is only available since darwin20
63+
elsif major == '10'
64+
minor + 4 # macos 10.X => darwinY offset, 10.15 is darwin19
65+
else
66+
minor + 20 # maxos 11.X => darwinY offset, 11.0 is darwin20
67+
end
68+
max = 20 # current known max to build for
6469

6570
(first..max).each do |version|
6671
next if version == current

ext/libv8-node/builder.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ def inject_libv8(version)
4141
end
4242

4343
def script(name)
44-
File.expand_path("../../libexec/#{name}", __dir__).tap { |v| p Dir.pwd; p v }
44+
File.expand_path("../../libexec/#{name}", __dir__).tap do |v|
45+
puts "==== in #{Dir.pwd}"
46+
puts "==== running #{v}"
47+
end
4548
end
4649
end
4750
end

libexec/build-libv8

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "parallel job count: ${NJOBS}"
1717

1818
cd "${src}/node-${version}"
1919

20-
if which python3 >/dev/null 2>&1; then
20+
if command -v python3 >/dev/null 2>&1; then
2121
PYTHON="${PYTHON:-python3}"
2222
else
2323
PYTHON="${PYTHON:-python2}"

libexec/download-node

+1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ esac
2121

2222
mkdir -p "${src}"
2323

24+
# shellcheck disable=SC2086
2425
curl ${CURLOPTS} -L -o "${src}/node-${version}.tar.gz" "https://github.com/nodejs/node/archive/v${version}.tar.gz"

libexec/inject-libv8

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ done
3636
cd "${BASEDIR}/out/${BUILDTYPE}"
3737

3838
rm -rf "${top}/vendor/v8/out.gn"
39+
# shellcheck disable=SC2043
3940
for lib in libv8_monolith.a; do
4041
dir="${top}/vendor/v8/out.gn/libv8/obj/$(dirname "${lib}")"
4142
mkdir -p "${dir}"

0 commit comments

Comments
 (0)