Skip to content

Commit 5865b51

Browse files
committed
Ruby: build extractor using cross
1 parent dc6f5f6 commit 5865b51

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

ruby/actions/create-extractor-pack/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
uses: actions/cache@v3
1111
with:
1212
path: ruby/extractor-pack
13-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}-${{ hashFiles('ruby/**/*.rs') }}-${{ hashFiles('ruby/codeql-extractor.yml', 'ruby/downgrades', 'ruby/tools', 'ruby/ql/lib/ruby.dbscheme', 'ruby/ql/lib/ruby.dbscheme.stats') }}
13+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/**/Cargo.lock', 'ruby/actions/create-extractor-pack/action.yml') }}-${{ hashFiles('ruby/**/*.rs') }}-${{ hashFiles('ruby/codeql-extractor.yml', 'ruby/downgrades', 'ruby/tools', 'ruby/ql/lib/ruby.dbscheme', 'ruby/ql/lib/ruby.dbscheme.stats') }}
1414
- name: Cache cargo
1515
uses: actions/cache@v3
1616
if: steps.cache-extractor.outputs.cache-hit != 'true'
@@ -19,9 +19,11 @@ runs:
1919
~/.cargo/registry
2020
~/.cargo/git
2121
ruby/target
22-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-qltest-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
22+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-qltest-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/**/Cargo.lock') }}
2323
- name: Build Extractor
2424
if: steps.cache-extractor.outputs.cache-hit != 'true'
2525
shell: bash
26-
run: scripts/create-extractor-pack.sh
26+
run: |
27+
cargo install cross --version 0.2.1
28+
scripts/create-extractor-pack.sh
2729
working-directory: ruby

ruby/scripts/create-extractor-pack.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
#!/bin/bash
22
set -eux
3-
3+
CARGO=cargo
44
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
55
platform="linux64"
6+
if which cross; then
7+
CARGO=cross
8+
fi
69
elif [[ "$OSTYPE" == "darwin"* ]]; then
710
platform="osx64"
811
else
912
echo "Unknown OS"
1013
exit 1
1114
fi
1215

13-
cargo build --release
16+
"$CARGO" build --release
1417

15-
cargo run --release -p ruby-generator -- --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
18+
"$CARGO" run --release -p ruby-generator -- --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
1619
codeql query format -i ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
1720

1821
rm -rf extractor-pack

0 commit comments

Comments
 (0)