Skip to content

Commit 8aaabe8

Browse files
authored
Merge pull request #299 from github/hvitved/actions-reuse
Add two 'composite' actions for reusing logic
2 parents 6f7d4fe + e201dae commit 8aaabe8

File tree

5 files changed

+39
-39
lines changed

5 files changed

+39
-39
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build Ruby CodeQL pack
2+
description: Builds the Ruby CodeQL pack
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: actions/cache@v2
7+
with:
8+
path: |
9+
~/.cargo/registry
10+
~/.cargo/git
11+
target
12+
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
13+
- name: Build Extractor
14+
shell: bash
15+
run: env "PATH=$PATH:${{ github.workspace }}/codeql" scripts/create-extractor-pack.sh
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Fetch CodeQL
2+
description: Fetches the latest version of CodeQL
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Fetch CodeQL
7+
shell: bash
8+
run: |
9+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
10+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
11+
unzip -q codeql-linux64.zip
12+
env:
13+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/dataset_measure.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,9 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v2
2525

26-
- name: Fetch CodeQL
27-
run: |
28-
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
29-
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
30-
unzip -q codeql-linux64.zip
31-
env:
32-
GITHUB_TOKEN: ${{ github.token }}
33-
- uses: actions/cache@v2
34-
with:
35-
path: |
36-
~/.cargo/registry
37-
~/.cargo/git
38-
target
39-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
40-
- name: Build Extractor
41-
run: env "PATH=$PATH:${{ github.workspace }}/codeql" scripts/create-extractor-pack.sh
26+
- uses: ./.github/actions/fetch-codeql
27+
28+
- uses: ./.github/actions/create-extractor-pack
4229

4330
- name: Checkout ${{ matrix.repo }}
4431
uses: actions/checkout@v2

.github/workflows/qhelp.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,8 @@ jobs:
2121
git diff --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep .inc.qhelp$ | xargs -d '\n' -rn1 basename | xargs -d '\n' -rn1 git grep -l) |
2222
sort -u | xargs -d '\n' -n1 printf "'%s' "
2323
24-
- name: Fetch CodeQL
25-
run: |
26-
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
27-
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
28-
unzip -q codeql-linux64.zip
29-
env:
30-
GITHUB_TOKEN: ${{ github.token }}
24+
- uses: ./.github/actions/fetch-codeql
25+
3126
- name: QHelp preview
3227
if: ${{ steps.changes.outputs.qhelp_files }}
3328
run: |

.github/workflows/qltest.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,22 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Fetch CodeQL
18-
run: |
19-
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
20-
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
21-
unzip -q codeql-linux64.zip
22-
env:
23-
GITHUB_TOKEN: ${{ github.token }}
24-
- uses: actions/cache@v2
25-
with:
26-
path: |
27-
~/.cargo/registry
28-
~/.cargo/git
29-
target
30-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
31-
- name: Build Extractor
32-
run: env "PATH=$PATH:${{ github.workspace }}/codeql" scripts/create-extractor-pack.sh
17+
- uses: ./.github/actions/fetch-codeql
18+
- uses: ./.github/actions/create-extractor-pack
3319
- name: Run QL tests
3420
run: |
3521
codeql/codeql pack install ql/test
3622
codeql/codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}" --additional-packs "${HOME}/.codeql/packages/codeql/suite-helpers/0.0.1" --consistency-queries ql/consistency-queries ql/test
23+
env:
24+
GITHUB_TOKEN: ${{ github.token }}
3725
- name: Check QL formatting
3826
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql/codeql query format --check-only
3927
- name: Check QL compilation
4028
run: |
4129
codeql/codeql pack install ql/src
4230
codeql/codeql query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}" "ql/src" "ql/examples"
31+
env:
32+
GITHUB_TOKEN: ${{ github.token }}
4333
- name: Check DB upgrade scripts
4434
run: |
4535
echo >empty.trap

0 commit comments

Comments
 (0)