-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (65 loc) · 2.52 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: CI
on: pull_request
jobs:
ci:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: [ "3.11" ]
poetry-version: [ "1.6.1" ]
env:
PYTHONDONTWRITEBYTECODE: 1
PYTHONUNBUFFERED: 1
SA_PASSWORD: Alaska2023
ACCEPT_EULA: Y
MSSQL_DB: AdventureWorksLT2022
MSSQL_HOST: localhost
MSSQL_USER: sa
MSSQL_SA_PASSWORD: Alaska2023
SQL_DATASOURCE_NAME: my_gxshakezz
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
volumes:
- ./adventure_works:/var/opt/mssql/restore
env:
SA_PASSWORD: Alaska2023
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 1433:1433
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'Alaska2023' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
#
- name: Install SQL Server Tools
run: sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18
- name: Download AdventureWorksLT2022 backup
run: |
curl -L -o AdventureWorksLT2022.bak https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksLT2022.bak
sudo cp AdventureWorksLT2022.bak adventure_works/
cd adventure_works
pwd
ls -la
- name: Restore AdventureWorksLT2022 backup
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'Alaska2023' -d master -Q 'RESTORE DATABASE AdventureWorksLT2022 FROM DISK = "/var/opt/mssql/restore/AdventureWorksLT2022.bak" WITH MOVE "AdventureWorksLT2022_Data" TO "/var/opt/mssql/data/AdventureWorksLT2022.mdf", MOVE "AdventureWorksLT2022_log" TO "/var/opt/mssql/data/AdventureWorksLT2022_log.ldf"'
- name: Cleanup
run: |
rm -f AdventureWorksLT2022.bak
sudo rm -rf adventure_works
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Test Code Coverage
run: poetry run coverage run -m pytest -v --cov=app --cov-report=xml
- name: Coveralls
uses: coverallsapp/github-action@v2