-
Notifications
You must be signed in to change notification settings - Fork 11
113 lines (96 loc) · 3.47 KB
/
Copy pathCDA-testing.yml
File metadata and controls
113 lines (96 loc) · 3.47 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
106
107
108
109
110
111
112
113
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
integration-tests:
name: integration-tests (Python ${{ matrix.python-version }}, CDA ${{ matrix.cda.name }},
schema ${{ matrix.schema.name }})
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
max-parallel: 6
matrix:
python-version: ['3.9', '3.13']
# Keep the release pins in sync with the environments (see CONTRIBUTING.md).
cda:
- name: latest
image: ghcr.io/usace/cwms-data-api:develop-nightly
- name: production
image: ghcr.io/usace/cwms-data-api:2026.05.12-i
- name: test
image: ghcr.io/usace/cwms-data-api:2026.08.31-testd
schema:
- name: latest
tag: latest-dev
- name: production
tag: '26.02.17'
- name: test
tag: 26.07.16-RC02
env:
CWMS_DATA_API_IMAGE: ${{ matrix.cda.image }}
CWMS_DATABASE_IMAGE: ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:${{ matrix.schema.tag }}
CWMS_SCHEMA_INSTALLER_IMAGE: ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/schema_installer:${{ matrix.schema.tag }}
steps:
- uses: actions/checkout@v7
- name: Clean up disk space, so we don't run out.
if: runner.os == 'Linux'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
- name: Set up backend
run: |
docker compose pull
docker compose up -d --wait --wait-timeout 2400
- name: Set Up Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
# Use actions-poetry to handle installation
- name: Install Poetry and Dependencies
uses: abatilo/actions-poetry@v4
# Set Poetry to use an in-project virtual environment
- name: Configure Poetry for in-project venv
run: poetry config virtualenvs.in-project true
# Poetry will handle installation and caching
- name: Cache Python dependencies
uses: actions/cache@v6
id: cache-poetry-venv
with:
path: .venv
key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-poetry-${{
hashFiles('poetry.lock') }}
# Install dependencies only if cache is missed
- name: Install dependencies
if: steps.cache-poetry-venv.outputs.cache-hit != 'true'
run: poetry install --no-root
# Run pytest and generate coverage report data.
- name: Run Tests and Check Types
run: |
poetry run pytest tests/cda/ --doctest-modules --cov --cov-report=xml:out/coverage.xml
poetry run mypy --strict cwms/
- name: Generate Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: out/coverage.xml
format: markdown
output: both
badge: true
- name: Generate Job Summary
uses: x-color/github-actions-job-summary@v0.1.1
with:
file: ./code-coverage-results.md
vars: |-
empty: empty
- name: Show backend logs on failure
if: failure()
run: docker compose logs --no-color --tail 200
- name: Stop test backend
if: always()
run: docker compose down --volumes