From 589c6d7387f5c4445d06464274010be583324e5f Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Tue, 3 Feb 2026 04:18:35 +0000 Subject: [PATCH] Add tests, fixtures, and CI/CD workflow --- .gitea/workflows/ci.yml | 141 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..25fc0d0 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,141 @@ +name: CI + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + os: [ubuntu-latest] + exclude: + - python-version: '3.8' + os: [macos-latest, windows-latest] + - python-version: '3.9' + os: [macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Lint with ruff + run: | + pip install ruff + ruff check . + + - name: Run tests with pytest + run: pytest -v + + - name: Run tests with coverage + run: | + pip install pytest-cov + pytest --cov=dataforge --cov-report=term-missing --cov-report=xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: ./coverage.xml + fail_ci_if_error: false + + test-minimal: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.8' + cache: 'pip' + + - name: Install and test + run: | + pip install --upgrade pip + pip install pytest + pip install -e . + pytest -v + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + + - name: Install linting tools + run: | + pip install ruff black mypy + + - name: Run ruff + run: ruff check . + + - name: Run black + run: black --check . + + - name: Run mypy + run: mypy dataforge/ --ignore-missing-imports + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + + - name: Install build tools + run: | + pip install build + + - name: Build package + run: python -m build + + - name: Verify package + run: | + pip install dist/*.whl + dataforge --help + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + + release: + needs: [test, lint, build] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v4 + + - name: Create Release + uses: https://gitea.com/actions/release-action@main + with: + files: | + dist/*.whl + dist/*.tar.gz + title: ${{ github.ref_name }} + body: "Release ${{ github.ref_name }}" + draft: false + prerelease: false