Files
vscode-codeql/.github/workflows/main.yml
2020-09-08 16:25:18 -07:00

114 lines
2.9 KiB
YAML

name: Build Extension
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: '10.18.1'
- name: Install dependencies
run: |
cd extensions/ql-vscode
npm install
shell: bash
- name: Build
run: |
cd extensions/ql-vscode
npm run build
shell: bash
- name: Prepare artifacts
if: matrix.os == 'ubuntu-latest'
run: |
mkdir artifacts
cp dist/*.vsix artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest'
with:
name: vscode-codeql-extension
path: artifacts
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: '10.18.1'
# We have to build the dependencies in `lib` before running any tests.
- name: Install dependencies
run: |
cd extensions/ql-vscode
npm install
shell: bash
- name: Build
run: |
cd extensions/ql-vscode
npm run build
shell: bash
- name: Lint
run: |
cd extensions/ql-vscode
npm run lint
- name: Install CodeQL
run: |
mkdir codeql-home
curl -L --silent https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql.zip -o codeql-home/codeql.zip
unzip -q -o codeql-home/codeql.zip -d codeql-home
unzip -q -o codeql-home/codeql.zip codeql/codeql.exe -d codeql-home
rm codeql-home/codeql.zip
shell: bash
- name: Run unit tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cd extensions/ql-vscode
CODEQL_PATH=$GITHUB_WORKSPACE/codeql-home/codeql/codeql npm run test
- name: Run unit tests (Windows)
if: matrix.os == 'windows-latest'
run: |
cd extensions/ql-vscode
$env:CODEQL_PATH=$(Join-Path $env:GITHUB_WORKSPACE -ChildPath 'codeql-home/codeql/codeql.exe')
npm run test
- name: Run integration tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cd extensions/ql-vscode
sudo apt-get install xvfb
/usr/bin/xvfb-run npm run integration
- name: Run integration tests (Windows)
if: matrix.os == 'windows-latest'
run: |
cd extensions/ql-vscode
npm run integration