Skip to content

Commit 60c6241

Browse files
committed
Swift: run QL tests on macOS
1 parent b8c1f1a commit 60c6241

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/actions/fetch-codeql/action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ description: Fetches the latest version of CodeQL
33
runs:
44
using: composite
55
steps:
6+
- name: Select platform - Linux
7+
if: runner.os == 'Linux'
8+
shell: bash
9+
run: echo "GA_CODEQL_CLI_PLATFORM=linux64" >> $GITHUB_ENV
10+
11+
- name: Select platform - MacOS
12+
if: runner.os == 'MacOS'
13+
shell: bash
14+
run: echo "GA_CODEQL_CLI_PLATFORM=osx64" >> $GITHUB_ENV
15+
616
- name: Fetch CodeQL
717
shell: bash
818
run: |
919
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 -d "${RUNNER_TEMP}" codeql-linux64.zip
20+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-$GA_CODEQL_CLI_PLATFORM.zip "$LATEST"
21+
unzip -q -d "${RUNNER_TEMP}" codeql-$GA_CODEQL_CLI_PLATFORM.zip
1222
echo "${RUNNER_TEMP}/codeql" >> "${GITHUB_PATH}"
1323
env:
1424
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/swift-qltest.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@ jobs:
2020
- name: Check QL formatting
2121
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
2222
qltest:
23-
runs-on: ubuntu-latest
23+
runs-on: ${{ matrix.os }}
2424
strategy:
2525
fail-fast: false
26+
matrix:
27+
os : [ubuntu-20.04, macos-latest]
2628
steps:
2729
- uses: actions/checkout@v2
2830
- uses: ./.github/actions/fetch-codeql
29-
- name: Install bazelisk
31+
- name: Install bazelisk - Linux
32+
if: runner.os == 'Linux'
3033
run: |
3134
sudo apt-get update
3235
sudo apt-get install -y wget
3336
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64
3437
mv bazelisk-linux-amd64 /usr/local/bin/bazel
3538
chmod +x /usr/local/bin/bazel
39+
- name: Install bazelisk - macOS
40+
if: runner.os == 'MacOS'
41+
run: |
42+
brew install bazelisk
3643
- name: Build Swift extractor
3744
run: |
3845
bazel run //swift:create-extractor-pack
@@ -41,3 +48,4 @@ jobs:
4148
codeql test run --threads=0 --ram 5000 --search-path "${{ github.workspace }}/swift/extractor-pack" --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition ql/test
4249
env:
4350
GITHUB_TOKEN: ${{ github.token }}
51+

0 commit comments

Comments
 (0)