Skip to content

Commit c66bf38

Browse files
committed
Update Ruby workflows
1 parent 393800e commit c66bf38

File tree

6 files changed

+89
-78
lines changed

6 files changed

+89
-78
lines changed

.github/workflows/qhelp.yml renamed to .github/workflows/qhelp-pr-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- main
77
- 'rc/*'
88
paths:
9-
- "**/*.qhelp"
9+
- "ruby/**/*.qhelp"
1010

1111
jobs:
1212
qhelp:
@@ -32,7 +32,7 @@ jobs:
3232
for path in ${{ steps.changes.outputs.qhelp_files }} ; do
3333
echo "<details> <summary>${path}</summary>"
3434
echo
35-
codeql/codeql generate query-help --format=markdown ${path}
35+
codeql generate query-help --format=markdown ${path}
3636
echo "</details>"
3737
done) | gh pr comment "${{ github.event.pull_request.number }}" -F -
3838
env:

.github/workflows/qltest.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/build.yml renamed to .github/workflows/ruby-build.yml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
name: Build / Release
1+
name: "Ruby: Build"
22

33
on:
44
push:
5+
paths:
6+
- 'ruby/**'
57
branches:
68
- main
79
- 'rc/*'
810
pull_request:
11+
paths:
12+
- 'ruby/**'
913
branches:
1014
- main
1115
- 'rc/*'
@@ -18,6 +22,10 @@ on:
1822
env:
1923
CARGO_TERM_COLOR: always
2024

25+
defaults:
26+
run:
27+
working-directory: ruby
28+
2129
jobs:
2230
build:
2331
strategy:
@@ -39,7 +47,7 @@ jobs:
3947
path: |
4048
~/.cargo/registry
4149
~/.cargo/git
42-
target
50+
ruby/target
4351
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('**/Cargo.lock') }}
4452
- name: Check formatting
4553
run: cargo fmt --all -- --check
@@ -56,20 +64,20 @@ jobs:
5664
if: ${{ matrix.os == 'ubuntu-latest' }}
5765
with:
5866
name: ruby.dbscheme
59-
path: ql/lib/ruby.dbscheme
67+
path: ruby/ql/lib/ruby.dbscheme
6068
- uses: actions/upload-artifact@v2
6169
if: ${{ matrix.os == 'ubuntu-latest' }}
6270
with:
6371
name: TreeSitter.qll
64-
path: ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
72+
path: ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
6573
- uses: actions/upload-artifact@v2
6674
with:
6775
name: extractor-${{ matrix.os }}
6876
path: |
69-
target/release/ruby-autobuilder
70-
target/release/ruby-autobuilder.exe
71-
target/release/ruby-extractor
72-
target/release/ruby-extractor.exe
77+
ruby/target/release/ruby-autobuilder
78+
ruby/target/release/ruby-autobuilder.exe
79+
ruby/target/release/ruby-extractor
80+
ruby/target/release/ruby-extractor.exe
7381
retention-days: 1
7482
compile-queries:
7583
runs-on: ubuntu-latest
@@ -106,7 +114,7 @@ jobs:
106114
with:
107115
name: codeql-ruby-queries
108116
path: |
109-
target/packs/*
117+
ruby/target/packs/*
110118
retention-days: 1
111119

112120
package:
@@ -117,19 +125,19 @@ jobs:
117125
- uses: actions/download-artifact@v2
118126
with:
119127
name: ruby.dbscheme
120-
path: ruby
128+
path: ruby/ruby
121129
- uses: actions/download-artifact@v2
122130
with:
123131
name: extractor-ubuntu-latest
124-
path: linux64
132+
path: ruby/linux64
125133
- uses: actions/download-artifact@v2
126134
with:
127135
name: extractor-windows-latest
128-
path: win64
136+
path: ruby/win64
129137
- uses: actions/download-artifact@v2
130138
with:
131139
name: extractor-macos-latest
132-
path: osx64
140+
path: ruby/osx64
133141
- run: |
134142
mkdir -p ruby
135143
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
@@ -145,12 +153,12 @@ jobs:
145153
- uses: actions/upload-artifact@v2
146154
with:
147155
name: codeql-ruby-pack
148-
path: codeql-ruby.zip
156+
path: ruby/codeql-ruby.zip
149157
retention-days: 1
150158
- uses: actions/download-artifact@v2
151159
with:
152160
name: codeql-ruby-queries
153-
path: qlpacks
161+
path: ruby/qlpacks
154162
- run: |
155163
echo '{
156164
"provide": [
@@ -162,18 +170,13 @@ jobs:
162170
- uses: actions/upload-artifact@v2
163171
with:
164172
name: codeql-ruby-bundle
165-
path: codeql-ruby-bundle.zip
173+
path: ruby/codeql-ruby-bundle.zip
166174
retention-days: 1
167-
- if: ${{ github.event.inputs.tag }}
168-
run: |
169-
gh release create --prerelease \
170-
--title "CodeQL Ruby (${{ github.event.inputs.tag }})" \
171-
--target "${{ github.sha }}" \
172-
"${{ github.event.inputs.tag }}" \
173-
codeql-ruby-bundle.zip
174-
env:
175-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175+
176176
test:
177+
defaults:
178+
run:
179+
working-directory: ${{ github.workspace }}
177180
strategy:
178181
fail-fast: false
179182
matrix:

.github/workflows/dataset_measure.yml renamed to .github/workflows/ruby-dataset-measure.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: Collect database stats
1+
name: "Ruby: Collect database stats"
22

33
on:
44
push:
55
branches:
66
- main
77
- 'rc/*'
88
paths:
9-
- ql/lib/ruby.dbscheme
9+
- ruby/ql/lib/ruby.dbscheme
1010
pull_request:
1111
branches:
1212
- main
1313
- 'rc/*'
1414
paths:
15-
- ql/lib/ruby.dbscheme
15+
- ruby/ql/lib/ruby.dbscheme
1616
workflow_dispatch:
1717

1818
jobs:
@@ -38,15 +38,15 @@ jobs:
3838
path: ${{ github.workspace }}/repo
3939
- name: Create database
4040
run: |
41-
codeql/codeql database create \
42-
--search-path "${{ github.workspace }}" \
41+
codeql database create \
42+
--search-path "${{ github.workspace }}/ruby" \
4343
--threads 4 \
4444
--language ruby --source-root "${{ github.workspace }}/repo" \
4545
"${{ runner.temp }}/database"
4646
- name: Measure database
4747
run: |
4848
mkdir -p "stats/${{ matrix.repo }}"
49-
codeql/codeql dataset measure --threads 4 --output "stats/${{ matrix.repo }}/stats.xml" "${{ runner.temp }}/database/db-ruby"
49+
codeql dataset measure --threads 4 --output "stats/${{ matrix.repo }}/stats.xml" "${{ runner.temp }}/database/db-ruby"
5050
- uses: actions/upload-artifact@v2
5151
with:
5252
name: measurements
@@ -64,8 +64,8 @@ jobs:
6464
path: stats
6565
- run: |
6666
python -m pip install --user lxml
67-
find stats -name 'stats.xml' | sort | xargs python scripts/merge_stats.py --output ql/lib/ruby.dbscheme.stats --normalise ruby_tokeninfo
67+
find stats -name 'stats.xml' | sort | xargs python ruby/scripts/merge_stats.py --output ruby/ql/lib/ruby.dbscheme.stats --normalise ruby_tokeninfo
6868
- uses: actions/upload-artifact@v2
6969
with:
7070
name: ruby.dbscheme.stats
71-
path: ql/lib/ruby.dbscheme.stats
71+
path: ruby/ql/lib/ruby.dbscheme.stats

.github/workflows/ruby-qltest.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Ruby: Run QL Tests"
2+
3+
on:
4+
push:
5+
paths:
6+
- 'ruby/**'
7+
branches:
8+
- main
9+
- 'rc/*'
10+
pull_request:
11+
paths:
12+
- 'ruby/**'
13+
branches:
14+
- main
15+
- 'rc/*'
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
20+
defaults:
21+
run:
22+
working-directory: ruby
23+
24+
jobs:
25+
qltest:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
with:
30+
submodules: true
31+
- uses: ./.github/actions/fetch-codeql
32+
- uses: ./ruby/actions/create-extractor-pack
33+
- name: Run QL tests
34+
run: |
35+
codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ruby" --additional-packs "${{ github.workspace }}/ruby/codeql" --consistency-queries ql/consistency-queries ql/test
36+
env:
37+
GITHUB_TOKEN: ${{ github.token }}
38+
- name: Check QL formatting
39+
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
40+
- name: Check QL compilation
41+
run: |
42+
codeql query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}/ruby" --additional-packs "${{ github.workspace }}/ruby/codeql" "ql/src" "ql/examples"
43+
env:
44+
GITHUB_TOKEN: ${{ github.token }}
45+
- name: Check DB upgrade scripts
46+
run: |
47+
echo >empty.trap
48+
codeql dataset import -S ql/lib/upgrades/initial/ruby.dbscheme testdb empty.trap
49+
codeql dataset upgrade testdb --additional-packs ql/lib/upgrades
50+
diff -q testdb/ruby.dbscheme ql/lib/ruby.dbscheme

.github/workflows/sync_files.yml renamed to .github/workflows/sync-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
with:
1919
submodules: true
2020
- name: Check synchronized files
21-
run: scripts/sync-identical-files.py
21+
run: ruby/scripts/sync-identical-files.py

0 commit comments

Comments
 (0)