Skip to content

CI

CI #1173

name: CI
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
actions: read
checks: write
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies and build extension
uses: ./.github/actions/build-extension
- name: Run lint
run: |
yarn lint
- name: Run tests
run: |
DISPLAY=:10 yarn test
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: 'Unit Test Report'
path: ./test-reports/**/*.xml
reporter: jest-junit
badge-title: 'unit-tests'
- name: Setup environment for smoke tests
run: |
echo "Setting up environment for smoke tests"
echo "PASSWORD=$(LC_ALL=C tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 16)$(LC_ALL=C tr -dc '@^#' < /dev/urandom | head -c 1)" >> $GITHUB_ENV
- name: Install mssql
run: |
sudo cp build/mssql.init /etc/init.d/mssql-server
sudo chmod +x /etc/init.d/mssql-server
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list)"
sudo apt-get update
sudo apt-get install -y mssql-server
sudo ACCEPT_EULA='Y' MSSQL_PID='Developer' MSSQL_SA_PASSWORD=${{ env.PASSWORD }} /opt/mssql/bin/mssql-conf setup || true
- name: Start mssql
run: |
sudo service mssql-server start
- name: Run smoke tests
run: |
VS_CODE_VERSION=stable
SERVER_NAME=localhost
AUTHENTICATION_TYPE="SQL Login"
USER_NAME=sa
PASSWORD=${{ env.PASSWORD }}
SAVE_PASSWORD=No
PROFILE_NAME=test-server
DISPLAY=:10 yarn smoketest
- name: Smoke Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: 'Smoke Test Report'
path: ./test-reports/**/smoke-results.xml
reporter: jest-junit
badge-title: 'smoke-tests'