Add SQL Server 2022 workflow contained on runner VM with Python #265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# | |
# See https://github.com/r-lib/actions/tree/master/examples#readme for | |
# additional example workflows available for the R community. | |
name: BuildAndTest | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
USER: ${{ secrets.USER }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
PASSWORD_AIRLINE_USER: ${{ secrets.PASSWORD_AIRLINE_USER }} | |
PASSWORD_AIRLINE_USER_DBOWNER: ${{ secrets.PASSWORD_AIRLINE_USER_DBOWNER }} | |
DRIVER: "{ODBC Driver 17 for SQL Server}" | |
jobs: | |
R: | |
runs-on: [self-hosted, 1ES.Pool=sqlmlutils_GH_RunnerPool] | |
strategy: | |
matrix: | |
include: | |
- r-version: "3.5.2" | |
sql-platform: "box" | |
- r-version: "4.2.0" | |
sql-platform: "box" | |
env: | |
# Define CI to skip some test case. | |
CI: True | |
DATABASE: ${{ secrets.DATABASE }} | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: Set SQL Server 2019 Env_var for R 3.5.2 | |
if: matrix.r-version == '3.5.2' && matrix.sql-platform == 'box' | |
run: echo SERVER=${{ secrets.SQL19SERVER }}>> %GITHUB_ENV% | |
shell: cmd | |
- name: Set SQL Server 2022 Env_var for R 4.2.0 | |
if: matrix.r-version == '4.2.0' && matrix.sql-platform == 'box' | |
run: echo SERVER=${{ secrets.SQL22SERVER }}>> %GITHUB_ENV% | |
shell: cmd | |
- name: Check Connectivity to SQL Database | |
run: | | |
sqlcmd -S tcp:%SERVER%,1433 -U %USER% -P %PASSWORD% -d %DATABASE% -l 5 -Q "SELECT @@VERSION" | |
shell: cmd | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Set up R ${{ matrix.r-version }} Runtime | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.r-version }} | |
- name: Install R Package Dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 2 | |
working-directory: ./R | |
extra-packages: | |
#Retrieves most recent odbc pkg from cran to avoid errors seen in older versions. | |
#Updated odbc pkg is still compatible with R >= 3.2.0 | |
cran::odbc | |
cran::xml2 | |
rcmdcheck | |
- uses: r-lib/actions/check-r-package@v2 | |
with: | |
working-directory: ./R | |
Python: | |
runs-on: [self-hosted, 1ES.Pool=sqlmlutils_GH_RunnerPool] | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- python-version: "3.7.1" | |
sql-platform: "box" | |
- python-version: "3.10.5" | |
sql-platform: "box" | |
env: | |
CI: True | |
DATABASE: ${{ secrets.DATABASE_PYTHON }} | |
steps: | |
- name: Set SQL Server 2019 Env_var for Python 3.7.1 | |
if: matrix.python-version == '3.7.1' && matrix.sql-platform == 'box' | |
run: echo SERVER=${{ secrets.SQL19SERVER }}>> %GITHUB_ENV% | |
shell: cmd | |
- name: Set SQL Server 2022 Env_var for Python 3.10.5 | |
if: matrix.python-version == '3.10.5' && matrix.sql-platform == 'box' | |
run: echo SERVER=${{ secrets.SQL22SERVER }}>> %GITHUB_ENV% | |
shell: cmd | |
- name: Check Connectivity SQL Database | |
run: | | |
sqlcmd -S tcp:%SERVER%,1433 -U %USER% -P %PASSWORD% -d %DATABASE% -l 5 -Q "SELECT @@VERSION" | |
shell: cmd | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
working-directory: ./Python | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 pytest | |
pip install -r requirements.txt | |
- name: Build Python Package | |
working-directory: ./Python | |
run: ./buildandinstall.cmd | |
- name: Run pytest | |
working-directory: ./Python/tests | |
run: | | |
pytest |