|
8 | 8 | branches: [main] |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - test: |
| 11 | + test-basic: |
12 | 12 | runs-on: ubuntu-latest |
13 | 13 | strategy: |
14 | 14 | matrix: |
15 | 15 | python-version: ["3.11", "3.12", "3.13"] |
16 | 16 | steps: |
17 | 17 | - uses: actions/checkout@v4 |
18 | 18 |
|
19 | | - # Install system dependencies (like in your Docker container) |
20 | 19 | - name: Install system dependencies |
21 | | - run: sudo apt-get update && sudo apt-get install -y libgl1 libglib2.0-0 python3-venv |
| 20 | + run: | |
| 21 | + sudo apt-get update |
| 22 | + sudo apt-get install -y libgl1 libglib2.0-0 python3-venv |
22 | 23 |
|
23 | | - # Set up Python |
24 | 24 | - uses: actions/setup-python@v5 |
25 | 25 | with: |
26 | 26 | python-version: ${{ matrix.python-version }} |
27 | 27 |
|
28 | | - # Create virtual environment |
29 | | - - name: Create virtual environment |
| 28 | + - name: Install dependencies |
30 | 29 | run: | |
31 | | - python -m venv venv |
32 | | - source venv/bin/activate |
33 | | - python -m pip install --upgrade pip setuptools wheel |
| 30 | + python -m pip install --upgrade pip |
34 | 31 | python -m pip install -e . |
35 | 32 | python -m pip install pytest ruff |
36 | 33 |
|
37 | | - # Run tests in the venv |
38 | | - - name: Run tests |
| 34 | + - name: Run basic tests |
| 35 | + env: |
| 36 | + TMEQ_RUN_CURVELETS: "0" |
| 37 | + QT_QPA_PLATFORM: "offscreen" |
| 38 | + run: | |
| 39 | + pytest -q -rs |
| 40 | +
|
| 41 | + # Secure build with CurveLab; skip on forked PRs (no secrets on forks). |
| 42 | + test-curvelab: |
| 43 | + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} |
| 44 | + runs-on: ubuntu-latest |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + python-version: ["3.11", "3.12"] |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - uses: actions/setup-python@v5 |
| 52 | + with: |
| 53 | + python-version: ${{ matrix.python-version }} |
| 54 | + |
| 55 | + - name: Install system dependencies |
| 56 | + run: | |
| 57 | + sudo apt-get update |
| 58 | + sudo apt-get install -y build-essential gcc g++ make wget curl unzip libgl1 libglib2.0-0 |
| 59 | +
|
| 60 | + - name: Fetch CurveLab archive |
| 61 | + shell: bash |
| 62 | + env: |
| 63 | + FETCH_FDCT: ${{ secrets.FETCH_FDCT }} |
| 64 | + run: | |
| 65 | + set -euo pipefail |
| 66 | + if [ -z "${FETCH_FDCT}" ]; then |
| 67 | + echo "::error title=Missing secret::FETCH_FDCT is empty. It must download utils/CurveLab-2.1.3.tar.gz." |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | + mkdir -p utils |
| 71 | + cd utils |
| 72 | + echo "-- Pre eval --" |
| 73 | + ls -la |
| 74 | + echo "Downloading CurveLab archive via FETCH_FDCT..." |
| 75 | + eval "${FETCH_FDCT}" |
| 76 | + echo "-- Post eval --" |
| 77 | + ls -la |
| 78 | + if [ ! -f "CurveLab-2.1.3.tar.gz" ]; then |
| 79 | + echo "::error title=CurveLab archive missing after FETCH_FDCT::Expected utils/CurveLab-2.1.3.tar.gz to exist after running FETCH_FDCT." |
| 80 | + echo "Files in utils/:" |
| 81 | + ls -la |
| 82 | + exit 1 |
| 83 | + fi |
| 84 | + if command -v file >/dev/null 2>&1; then |
| 85 | + echo "Downloaded archive mime-type:" |
| 86 | + MIME="$(file -b --mime-type "CurveLab-2.1.3.tar.gz" || true)" |
| 87 | + echo "${MIME}" |
| 88 | + if [[ "${MIME}" == text/html* ]]; then |
| 89 | + echo "::error title=CurveLab download returned HTML::Likely a 403/redirect. Showing first 40 lines:" |
| 90 | + head -n 40 "CurveLab-2.1.3.tar.gz" || true |
| 91 | + echo "Fix: update FETCH_FDCT to use 'curl --fail-with-body -fL ... -o CurveLab-2.1.3.tar.gz <URL>' so it fails on 403 instead of saving HTML." |
| 92 | + exit 1 |
| 93 | + fi |
| 94 | + fi |
| 95 | +
|
| 96 | + - name: Prepare FFTW + CurveLab toolchain |
| 97 | + env: |
| 98 | + FDCT: "" |
| 99 | + FFTW: "" |
| 100 | + CPPFLAGS: "" |
| 101 | + LDFLAGS: "" |
| 102 | + run: | |
| 103 | + unset FDCT FFTW CPPFLAGS LDFLAGS |
| 104 | + bash .github/ci_setup_curvelab.sh |
| 105 | +
|
| 106 | + - name: Validate CurveLab libraries |
| 107 | + run: | |
| 108 | + echo "Testing CurveLab compilation..." |
| 109 | + if [ -z "${FDCT:-}" ]; then |
| 110 | + echo "❌ FDCT environment variable not set by ci_setup_curvelab.sh" |
| 111 | + exit 1 |
| 112 | + fi |
| 113 | + echo "FDCT=${FDCT}" |
| 114 | + ls -la "${FDCT}" || true |
| 115 | + ls -la "${FDCT}/fdct_wrapping_cpp/src" || true |
| 116 | + ls -la "${FDCT}/fdct3d/src" || true |
| 117 | + test -f "${FDCT}/fdct_wrapping_cpp/src/libfdct_wrapping.a" && echo "✅ libfdct_wrapping.a built" || (echo "❌ libfdct_wrapping.a missing"; exit 1) |
| 118 | + test -f "${FDCT}/fdct3d/src/libfdct3d.a" && echo "✅ libfdct3d.a built" || (echo "❌ libfdct3d.a missing"; exit 1) |
| 119 | +
|
| 120 | + - name: Install Python dependencies |
| 121 | + run: | |
| 122 | + python -m pip install --upgrade pip |
| 123 | + python -m pip install -e ".[curvelops]" |
| 124 | + python -m pip install pytest ruff |
| 125 | +
|
| 126 | + - name: Run tests with CurveLab |
39 | 127 | env: |
| 128 | + TMEQ_RUN_CURVELETS: "1" |
40 | 129 | QT_QPA_PLATFORM: "offscreen" |
41 | 130 | run: | |
42 | | - source venv/bin/activate |
43 | | - pytest -rs |
| 131 | + pytest -q -rs |
0 commit comments