|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + unit-tests: |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + timeout-minutes: 20 |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v7 |
| 24 | + |
| 25 | + - name: Set up Python ${{ matrix.python-version }} |
| 26 | + uses: actions/setup-python@v7 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + pip install -e ".[test]" |
| 33 | +
|
| 34 | + - name: Run unit tests |
| 35 | + run: pytest tests/ -v -m "not live" --timeout=120 --timeout-method=thread --cov=daos_fsspec --cov-report=term-missing --cov-report=xml |
| 36 | + |
| 37 | + - name: Upload coverage |
| 38 | + if: matrix.python-version == '3.12' |
| 39 | + uses: actions/upload-artifact@v7 |
| 40 | + with: |
| 41 | + name: coverage-report |
| 42 | + path: coverage.xml |
| 43 | + |
| 44 | + lint: |
| 45 | + runs-on: ubuntu-24.04 |
| 46 | + timeout-minutes: 10 |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v7 |
| 49 | + |
| 50 | + - name: Set up Python |
| 51 | + uses: actions/setup-python@v7 |
| 52 | + with: |
| 53 | + python-version: "3.12" |
| 54 | + |
| 55 | + - name: Install ruff |
| 56 | + run: pip install ruff |
| 57 | + |
| 58 | + - name: Lint |
| 59 | + run: ruff check daos_fsspec/ tests/ |
| 60 | + |
| 61 | + - name: Format check |
| 62 | + run: ruff format --check daos_fsspec/ tests/ |
| 63 | + |
| 64 | + typecheck: |
| 65 | + runs-on: ubuntu-24.04 |
| 66 | + timeout-minutes: 10 |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v7 |
| 69 | + |
| 70 | + - name: Set up Python |
| 71 | + uses: actions/setup-python@v7 |
| 72 | + with: |
| 73 | + python-version: "3.12" |
| 74 | + |
| 75 | + - name: Install dependencies |
| 76 | + run: | |
| 77 | + pip install "mypy>=1.0,<1.19" fsspec |
| 78 | + pip install --no-deps -e . |
| 79 | +
|
| 80 | + - name: Type check |
| 81 | + run: mypy daos_fsspec/ --ignore-missing-imports |
| 82 | + |
| 83 | + build: |
| 84 | + runs-on: ubuntu-24.04 |
| 85 | + timeout-minutes: 10 |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v7 |
| 88 | + |
| 89 | + - name: Set up Python |
| 90 | + uses: actions/setup-python@v7 |
| 91 | + with: |
| 92 | + python-version: "3.12" |
| 93 | + |
| 94 | + - name: Install build tools |
| 95 | + run: pip install build |
| 96 | + |
| 97 | + - name: Build sdist and wheel |
| 98 | + run: python -m build |
| 99 | + |
| 100 | + - name: Verify wheel contents |
| 101 | + run: | |
| 102 | + pip install dist/*.whl |
| 103 | + python -c "import daos_fsspec; print(daos_fsspec.__version__)" |
| 104 | + python -c "from daos_fsspec import DFSFileSystem; print('OK')" |
| 105 | +
|
| 106 | + - name: Upload artifacts |
| 107 | + uses: actions/upload-artifact@v7 |
| 108 | + with: |
| 109 | + name: dist |
| 110 | + path: dist/ |
| 111 | + |
| 112 | + live-tests: |
| 113 | + name: live-tests (DAOS ${{ matrix.daos_version }}) |
| 114 | + if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' |
| 115 | + runs-on: ubuntu-24.04 |
| 116 | + timeout-minutes: 45 |
| 117 | + strategy: |
| 118 | + fail-fast: false |
| 119 | + matrix: |
| 120 | + daos_version: ["2.6.5", "2.8.0"] |
| 121 | + |
| 122 | + steps: |
| 123 | + - uses: actions/checkout@v7 |
| 124 | + |
| 125 | + - name: Disable transparent hugepages |
| 126 | + run: | |
| 127 | + echo "THP before: $(cat /sys/kernel/mm/transparent_hugepage/enabled)" |
| 128 | + echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled |
| 129 | + echo "THP after: $(cat /sys/kernel/mm/transparent_hugepage/enabled)" |
| 130 | +
|
| 131 | + - name: Prepare memory for RAM-backed SCM |
| 132 | + run: | |
| 133 | + sudo sysctl vm.nr_hugepages=0 |
| 134 | + free -h |
| 135 | +
|
| 136 | + - name: Run live tests against DAOS ${{ matrix.daos_version }} |
| 137 | + env: |
| 138 | + DAOS_VERSION: ${{ matrix.daos_version }} |
| 139 | + shell: bash -euo pipefail {0} |
| 140 | + run: | |
| 141 | + chmod +x docker/test.sh |
| 142 | + docker/test.sh --live --skip-unit 2>&1 | tee live-test.log |
| 143 | +
|
| 144 | + - name: Dump cluster state on failure |
| 145 | + if: failure() |
| 146 | + run: | |
| 147 | + docker ps -a || true |
| 148 | + docker logs daos-test-server 2>&1 | tail -100 || true |
| 149 | + docker logs daos-test-client 2>&1 | tail -50 || true |
| 150 | + docker exec daos-test-server cat /tmp/daos_engine.log 2>&1 | tail -50 || true |
| 151 | +
|
| 152 | + - name: Publish result to job summary |
| 153 | + if: always() |
| 154 | + run: | |
| 155 | + { |
| 156 | + echo "### DAOS ${{ matrix.daos_version }} live integration tests" |
| 157 | + echo '```' |
| 158 | + grep -E 'passed|failed|error' live-test.log | tail -5 || true |
| 159 | + echo '```' |
| 160 | + } >> "$GITHUB_STEP_SUMMARY" |
| 161 | +
|
| 162 | + - name: Upload live test log |
| 163 | + if: always() |
| 164 | + uses: actions/upload-artifact@v7 |
| 165 | + with: |
| 166 | + name: live-test-log-${{ matrix.daos_version }} |
| 167 | + path: live-test.log |
0 commit comments