Skip to content

Commit 6b28c07

Browse files
committed
Add Action to build and upload qhelp
1 parent 3dde501 commit 6b28c07

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.github/workflows/codeqltest.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
echo "Done"
2121
cd $HOME
2222
echo "Downloading CodeQL CLI..."
23-
curl https://github.com/github/codeql-cli-binaries/releases/download/v2.2.5/codeql.zip -L -o codeql.zip
23+
curl https://github.com/github/codeql-cli-binaries/releases/download/v2.3.0/codeql.zip -L -o codeql.zip
2424
echo "Done"
2525
echo "Unpacking CodeQL CLI..."
2626
unzip -q codeql.zip
@@ -36,6 +36,15 @@ jobs:
3636
- name: Check that all QL and Go code is autoformatted
3737
run: env PATH=$PATH:$HOME/codeql make check-formatting
3838

39+
- name: Compile qhelp files to markdown
40+
run: env PATH=$PATH:$HOME/codeql QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown
41+
42+
- name: Upload qhelp markdown
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: qhelp-markdown
46+
path: qhelp-out/**/*.md
47+
3948
- name: Test
4049
run: env PATH=$PATH:$HOME/codeql make test
4150

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ check-formatting:
3737
find ql/src -name "*.ql" -or -name "*.qll" | xargs codeql query format --check-only
3838
test -z "$$(git ls-files | grep \\.go$ | grep -v ^vendor/ | xargs grep -L "//\s*autoformat-ignore" | xargs gofmt -l)"
3939

40+
ifeq ($(QHELP_OUT_DIR),)
41+
# If not otherwise specified, compile qhelp to markdown in place
42+
QHELP_OUT_DIR := ql/src
43+
endif
44+
45+
qhelp-to-markdown:
46+
scripts/qhelp-to-markdown.sh ql/src "$(QHELP_OUT_DIR)"
47+
4048
tools: $(addsuffix $(EXE),$(addprefix tools/bin/,$(BINARIES))) tools/tokenizer.jar
4149

4250
.PHONY: $(addsuffix $(EXE),$(addprefix tools/bin/,$(BINARIES)))

scripts/qhelp-to-markdown.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ $# -ne 2 ]; then
6+
echo "Usage: qhelp-to-markdown.sh qhelp-directory out-directory"
7+
exit 1
8+
fi
9+
10+
for qh in $(find $1 -name "*.qhelp"); do
11+
mkdir -p $2/$(dirname $qh)
12+
codeql generate query-help --format=markdown $qh > $2/${qh/qhelp/md}
13+
done

0 commit comments

Comments
 (0)