Adds DOI. #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| jobs: | |
| lint: | |
| name: Lint Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-lint-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-lint- | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff | |
| - name: Run ruff check | |
| run: ruff check src/ tests/ | |
| - name: Run ruff format check | |
| run: ruff format --check src/ tests/ | |
| type-check: | |
| name: Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-typecheck-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-typecheck- | |
| ${{ runner.os }}-pip- | |
| - name: Install package and dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run mypy | |
| run: mypy --strict src/ | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ~/Library/Caches/pip | |
| ~\AppData\Local\pip\Cache | |
| key: ${{ runner.os }}-pip-test-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-test- | |
| ${{ runner.os }}-pip- | |
| - name: Install package and test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run tests with pytest | |
| run: | | |
| pytest tests/ -v --cov=src/glazing --cov-report=term-missing --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| test-minimal-install: | |
| name: Test Minimal Install | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Test minimal installation | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install . | |
| # Test that CLI is available | |
| glazing --version | |
| glazing --help | |
| # Test that package can be imported | |
| python -c "import glazing; print(f'Glazing version: {glazing.__version__}')" | |
| integration-test: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-integration-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-integration- | |
| ${{ runner.os }}-pip- | |
| - name: Cache test data | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/glazing_test_data | |
| key: ${{ runner.os }}-glazing-test-data-v1 | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Test CLI commands | |
| run: | | |
| # Test download commands (dry run) | |
| glazing download list | |
| glazing download info verbnet | |
| # Test convert commands | |
| glazing convert list | |
| glazing convert info --dataset verbnet | |
| # Test search help | |
| glazing search --help | |
| - name: Test data conversion (small sample) | |
| run: | | |
| # Create sample data files for testing conversion | |
| mkdir -p test_data/verbnet test_output | |
| # Create a minimal VerbNet XML file | |
| cat > test_data/verbnet/test.xml << 'EOF' | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE VNCLASS SYSTEM "verbnet.dtd"> | |
| <VNCLASS ID="run-51.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="verbnet.xsd"> | |
| <MEMBERS> | |
| <MEMBER name="run" grouping="run.01"/> | |
| </MEMBERS> | |
| <THEMROLES> | |
| <THEMROLE type="Agent"> | |
| <SELRESTRS> | |
| <SELRESTR Value="+" type="animate"/> | |
| </SELRESTRS> | |
| </THEMROLE> | |
| </THEMROLES> | |
| <FRAMES> | |
| <FRAME> | |
| <DESCRIPTION primary="NP V" descriptionNumber="0.1" secondary="Basic"/> | |
| <EXAMPLES> | |
| <EXAMPLE>They run.</EXAMPLE> | |
| </EXAMPLES> | |
| <SYNTAX> | |
| <NP value="Agent"> | |
| <SYNRESTRS/> | |
| </NP> | |
| <VERB/> | |
| </SYNTAX> | |
| <SEMANTICS> | |
| <PRED value="motion"> | |
| <ARGS> | |
| <ARG type="Event" value="e"/> | |
| <ARG type="ThemRole" value="Agent"/> | |
| </ARGS> | |
| </PRED> | |
| </SEMANTICS> | |
| </FRAME> | |
| </FRAMES> | |
| </VNCLASS> | |
| EOF | |
| # Test VerbNet conversion | |
| glazing convert dataset --dataset verbnet --input-dir test_data/verbnet --output-dir test_output | |
| # Verify output was created | |
| test -f test_output/verbnet.jsonl || exit 1 | |
| # Check that the file has content | |
| [ -s test_output/verbnet.jsonl ] || exit 1 | |
| echo "Integration tests passed!" | |
| build: | |
| name: Build Distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build distribution | |
| run: python -m build | |
| - name: Check distribution | |
| run: twine check dist/* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| all-checks-pass: | |
| name: All Checks Pass | |
| needs: [lint, type-check, test, test-minimal-install, integration-test, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Summary | |
| run: echo "All CI checks passed successfully!" |