Repository navigation
102 lines (92 loc) · 3.55 KB
/
Copy pathshared-tests.yml
File metadata and controls
102 lines (92 loc) · 3.55 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
name: Shared Test Steps
on:
workflow_call:
inputs:
python-version:
description: 'Python version to use'
required: true
type: string
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python-version }}
- name: create-json
id: create-json
uses: jsdaniell/create-json@1.1.2
with:
name: "credentials.json"
json: ${{ secrets.VALID_SKYFLOW_CREDS_TEST }}
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install "codespell>=2.4.1" "ruff>=0.9.0" "coverage>=7.8.0"
- name: Run Spell Check
run: codespell
- name: Run Linter Ruff
run: ruff check . --output-format=github
# Each module (common, skyvault, flowvault) is its own installable
# distribution with its own setup.py and test suite, mirroring Java's
# per-module Maven build. A module directory that doesn't exist yet
# (pre-migration) is skipped with a notice rather than failing the job.
- name: Build, install and test each module
run: |
# Run every module even if one fails, then fail the job if any did, so a
# single module never hides the others' results. common/ is imported as a
# namespace package (e.g. common.vault has no __init__), so the repo root is
# added to PYTHONPATH for import resolution across all modules.
overall_rc=0
for module in common skyvault flowvault; do
if [ ! -f "$module/setup.py" ]; then
echo "::notice::$module/setup.py not found yet - skipping (pre-migration)."
continue
fi
cp credentials.json "$module/credentials.json"
(
cd "$module"
python -m pip install --upgrade pip setuptools wheel
python setup.py sdist bdist_wheel
pip install dist/*.whl
if [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
PYTHONPATH="$GITHUB_WORKSPACE:$PYTHONPATH" python -m coverage run --source=. -m unittest discover
coverage xml -o test-coverage.xml
)
module_rc=$?
if [ "$module_rc" -ne 0 ]; then
echo "::error::$module unit tests failed (exit $module_rc)."
overall_rc=1
fi
done
exit $overall_rc
- name: Codecov (common)
if: hashFiles('common/test-coverage.xml') != ''
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
files: common/test-coverage.xml
flags: common
name: codecov-skyflow-python-common
verbose: true
- name: Codecov (skyvault)
if: hashFiles('skyvault/test-coverage.xml') != ''
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
files: skyvault/test-coverage.xml
flags: skyvault
name: codecov-skyflow-python-skyvault
verbose: true
- name: Codecov (flowvault)
if: hashFiles('flowvault/test-coverage.xml') != ''
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
files: flowvault/test-coverage.xml
flags: flowvault
name: codecov-skyflow-python-flowvault
verbose: true