-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·150 lines (143 loc) · 5.29 KB
/
ci.yml
File metadata and controls
executable file
·150 lines (143 loc) · 5.29 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
env:
UV_PROJECT_ENVIRONMENT: /tmp/fp-wraptr-lint-venv
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- run: uv sync --extra dev
- run: uv run ruff check src/ tests/
- run: uv run ruff format --check src/ tests/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
env:
UV_PROJECT_ENVIRONMENT: /tmp/fp-wraptr-test-${{ matrix.python-version }}-venv
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras
- run: uv run pytest
fpr-release-surface:
runs-on: ubuntu-latest
env:
UV_PROJECT_ENVIRONMENT: /tmp/fp-wraptr-fpr-release-venv
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
- name: Install R
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends r-base-core
- name: Bootstrap supported external-venv workflow
run: |
chmod +x scripts/uvsync scripts/uvsafe
bash -n scripts/uvsync scripts/uvsafe
scripts/uvsync --all-extras
- name: Verify documented fp-r wrapper workflow
run: |
scripts/uvsafe fp --help
rm -rf /tmp/fpr-public-ci
scripts/uvsafe fp run examples/fpr_bundle_demo.yaml --backend fp-r --output-dir /tmp/fpr-public-ci
latest="$(ls -td /tmp/fpr-public-ci/fpr_bundle_demo_* | head -1)"
test -f "$latest/PABEV.TXT"
test -f "$latest/LOADFORMAT.DAT"
test -f "$latest/fp_r_series.csv"
test -f "$latest/fp_r_report.txt"
- name: Run focused tracked fp-r tests
run: |
scripts/uvsafe python -m pytest -q tests/test_backend.py tests/test_cli.py -k "fpr or fp_r or backend_requires_fp_home"
- name: Run fp-r R suite
run: |
Rscript fp-r/tests/testthat.R
- name: Build package artifacts
run: |
rm -rf /tmp/fp-wraptr-build-ci
uv build -o /tmp/fp-wraptr-build-ci
- name: Verify fp-r runtime in wheel and sdist
run: |
python - <<'PY'
from pathlib import Path
import tarfile
import zipfile
build_dir = Path("/tmp/fp-wraptr-build-ci")
wheel = next(build_dir.glob("*.whl"))
sdist = next(build_dir.glob("*.tar.gz"))
required_wheel = {
"fp-r/DESCRIPTION",
"fp-r/NAMESPACE",
"fp-r/R/000_utils.R",
"fp-r/R/bundle.R",
"fp-r/R/dependency.R",
"fp-r/R/equations.R",
"fp-r/R/expressions.R",
"fp-r/R/legacy_data.R",
"fp-r/R/mini_run.R",
"fp-r/R/parser.R",
"fp-r/R/periods.R",
"fp-r/R/solver.R",
"fp-r/R/standard_input.R",
"fp-r/scripts/run_backend_bundle.R",
}
with zipfile.ZipFile(wheel) as zf:
wheel_names = set(zf.namelist())
missing_wheel = sorted(required_wheel - wheel_names)
if missing_wheel:
raise SystemExit(f"wheel missing fp-r runtime files: {missing_wheel}")
required_sdist = {f"fp_wraptr-0.2.0/{name}" for name in required_wheel}
with tarfile.open(sdist, "r:gz") as tf:
sdist_names = set(tf.getnames())
missing_sdist = sorted(required_sdist - sdist_names)
if missing_sdist:
raise SystemExit(f"sdist missing fp-r runtime files: {missing_sdist}")
PY
fp-integration:
# Optional: enable only when FP assets provisioning inputs are configured.
if: ${{ vars.FP_INTEGRATION_ENABLED == 'true' }}
runs-on: ubuntu-latest
env:
UV_PROJECT_ENVIRONMENT: /tmp/fp-wraptr-fp-integration-venv
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
- name: Provision FP assets
env:
FP_ASSETS_SOURCE_DIR: ${{ vars.FP_ASSETS_SOURCE_DIR }}
FP_ASSETS_ARCHIVE_URL: ${{ secrets.FP_ASSETS_ARCHIVE_URL }}
FP_ASSETS_BEARER_TOKEN: ${{ secrets.FP_ASSETS_BEARER_TOKEN }}
FP_ASSETS_ARCHIVE_SHA256: ${{ vars.FP_ASSETS_ARCHIVE_SHA256 }}
FP_ASSETS_ARCHIVE_TYPE: ${{ vars.FP_ASSETS_ARCHIVE_TYPE }}
run: bash scripts/ci/provision_fp_assets.sh
- name: Install Wine
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends wine64
- run: uv sync --all-extras
- name: Verify FP assets
run: |
test -f "${GITHUB_WORKSPACE}/FM/fp.exe"
test -f "${GITHUB_WORKSPACE}/FM/fminput.txt"
test -f "${GITHUB_WORKSPACE}/FM/fmdata.txt"
test -f "${GITHUB_WORKSPACE}/FM/fmage.txt"
test -f "${GITHUB_WORKSPACE}/FM/fmexog.txt"
- name: Run fp.exe integration tests
env:
FP_HOME: ${{ github.workspace }}/FM
WINEPREFIX: /tmp/wine-fp-wraptr
run: uv run pytest -m requires_fp tests/test_fp_integration.py -q