-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (89 loc) · 3.22 KB
/
pytest-linux.yaml
File metadata and controls
105 lines (89 loc) · 3.22 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: pytest linux
on:
push:
pull_request:
branches: [main]
schedule:
- cron: "15 7 * * *"
env:
PYTHONPATH: ${{ github.workspace }}/src
SENZING_TOOLS_DATABASE_URL: sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
permissions: {}
jobs:
pytest-linux:
name: "pytest with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Python ${{ matrix.python-version }}"
outputs:
status: ${{ job.status }}
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
senzingsdk-version: [production-v4, staging-v4]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m venv ./venv
source ./venv/bin/activate
echo "PATH=${PATH}" >> "${GITHUB_ENV}"
python -m pip install --upgrade pip
python -m pip install --group all .
- name: Install Senzing SDK
uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
senzingsdk-version: ${{ matrix.senzingsdk-version }}
- name: Set environment variables
run: |
SENZING_PATH="/opt/senzing"
{
echo "SENZING_PATH=${SENZING_PATH}"
echo "LD_LIBRARY_PATH=${SENZING_PATH}/er/lib"
} >> "$GITHUB_ENV"
- name: Copy /etc files
run: |
sudo mkdir -p /etc/opt/senzing
sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing/g2.lic
- name: Copy test database files
run: |
mkdir -p /tmp/sqlite
cp testdata/sqlite/G2C.db /tmp/sqlite/
- name: Run pytest
run: |
source ./venv/bin/activate
pytest tests/ --verbose --capture=no --cov=src --cov-append
- name: Rename coverage file
env:
COVERAGE_FILE: "coverage.${{ matrix.python-version }}-${{ matrix.senzingsdk-version }}"
run: |
mv .coverage "$COVERAGE_FILE"
- name: Store coverage file
uses: actions/upload-artifact@v5
with:
name: "coverage-${{ matrix.python-version }}-${{ matrix.senzingsdk-version }}"
path: "coverage.${{ matrix.python-version }}-${{ matrix.senzingsdk-version }}"
coverage:
name: Coverage
needs: pytest-linux
permissions:
pull-requests: write
contents: write
uses: senzing-factory/build-resources/.github/workflows/python-coverage-comment.yaml@v3
slack-notification:
needs: [pytest-linux]
if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.pytest-linux.outputs.status ) && (github.ref_name == github.event.repository.default_branch || github.event_name == 'schedule') }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v3
with:
job-status: ${{ needs.pytest-linux.outputs.status }}