grai-build 0.3.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. grai_build-0.4.1/.github/ISSUE_TEMPLATE/bug_report.yml +89 -0
  2. grai_build-0.4.1/.github/ISSUE_TEMPLATE/config.yml +8 -0
  3. grai_build-0.4.1/.github/ISSUE_TEMPLATE/feature_request.yml +65 -0
  4. grai_build-0.4.1/.github/PULL_REQUEST_TEMPLATE.md +52 -0
  5. grai_build-0.4.1/.github/dependabot.yml +25 -0
  6. grai_build-0.4.1/.github/workflows/ci.yml +177 -0
  7. grai_build-0.4.1/.github/workflows/docs.yml +92 -0
  8. grai_build-0.4.1/.github/workflows/release.yml +146 -0
  9. grai_build-0.4.1/.github/workflows/security.yml +81 -0
  10. grai_build-0.4.1/.gitignore +75 -0
  11. grai_build-0.4.1/.pre-commit-config.yaml +54 -0
  12. grai_build-0.4.1/CODE_OF_CONDUCT.md +43 -0
  13. grai_build-0.4.1/CONTRIBUTING.md +331 -0
  14. {grai_build-0.3.0 → grai_build-0.4.1}/LICENSE +1 -1
  15. {grai_build-0.3.0 → grai_build-0.4.1}/PKG-INFO +6 -6
  16. grai_build-0.4.1/PRODUCTION_READY.md +204 -0
  17. {grai_build-0.3.0 → grai_build-0.4.1}/README.md +2 -2
  18. grai_build-0.4.1/SECURITY.md +64 -0
  19. grai_build-0.4.1/codecov.yml +35 -0
  20. grai_build-0.4.1/docs/CACHE.md +462 -0
  21. grai_build-0.4.1/docs/CI_CD.md +426 -0
  22. grai_build-0.4.1/docs/CLI.md +517 -0
  23. grai_build-0.4.1/docs/CLI_USAGE.md +632 -0
  24. grai_build-0.4.1/docs/COMPILER.md +469 -0
  25. grai_build-0.4.1/docs/DATA_LOADING.md +408 -0
  26. grai_build-0.4.1/docs/ENHANCED_SOURCES.md +248 -0
  27. grai_build-0.4.1/docs/GETTING_STARTED.md +866 -0
  28. grai_build-0.4.1/docs/LINEAGE.md +835 -0
  29. grai_build-0.4.1/docs/MIGRATIONS.md +841 -0
  30. grai_build-0.4.1/docs/NEO4J_SETUP.md +707 -0
  31. grai_build-0.4.1/docs/PARSER.md +239 -0
  32. grai_build-0.4.1/docs/PHILOSOPHY.md +481 -0
  33. grai_build-0.4.1/docs/PROGRESS.md +1153 -0
  34. grai_build-0.4.1/docs/SOURCE_CONFIG.md +222 -0
  35. grai_build-0.4.1/docs/VALIDATOR.md +338 -0
  36. grai_build-0.4.1/docs/VISUALIZER.md +560 -0
  37. grai_build-0.4.1/docs/index.md +138 -0
  38. grai_build-0.4.1/docs/javascripts/extra.js +5 -0
  39. grai_build-0.4.1/docs/stylesheets/extra.css +0 -0
  40. {grai_build-0.3.0 → grai_build-0.4.1}/grai/__init__.py +1 -2
  41. {grai_build-0.3.0 → grai_build-0.4.1}/grai/cli/main.py +287 -0
  42. grai_build-0.4.1/grai/core/migrations/__init__.py +30 -0
  43. grai_build-0.4.1/grai/core/migrations/differ.py +285 -0
  44. grai_build-0.4.1/grai/core/migrations/executor.py +346 -0
  45. grai_build-0.4.1/grai/core/migrations/generator.py +431 -0
  46. grai_build-0.4.1/grai/core/migrations/models.py +160 -0
  47. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/models.py +20 -0
  48. grai_build-0.4.1/grai.yml +19 -0
  49. {grai_build-0.3.0 → grai_build-0.4.1}/grai_build.egg-info/PKG-INFO +6 -6
  50. grai_build-0.4.1/grai_build.egg-info/SOURCES.txt +101 -0
  51. {grai_build-0.3.0 → grai_build-0.4.1}/grai_build.egg-info/requires.txt +1 -1
  52. grai_build-0.4.1/mkdocs.yml +148 -0
  53. {grai_build-0.3.0 → grai_build-0.4.1}/pyproject.toml +9 -5
  54. grai_build-0.4.1/requirements-docs.txt +6 -0
  55. grai_build-0.4.1/templates/entities/customer.yml +39 -0
  56. grai_build-0.4.1/templates/entities/order.yml +36 -0
  57. grai_build-0.4.1/templates/entities/product.yml +34 -0
  58. grai_build-0.4.1/templates/grai.yml +15 -0
  59. grai_build-0.4.1/templates/graph-custom-demo.html +259 -0
  60. grai_build-0.4.1/templates/graph-cytoscape-demo.html +202 -0
  61. grai_build-0.4.1/templates/graph-cytoscape.html +202 -0
  62. grai_build-0.4.1/templates/graph-d3-demo.html +259 -0
  63. grai_build-0.4.1/templates/graph-d3.html +259 -0
  64. grai_build-0.4.1/templates/lineage.dot +15 -0
  65. grai_build-0.4.1/templates/lineage.mmd +18 -0
  66. grai_build-0.4.1/templates/relations/purchased.yml +41 -0
  67. grai_build-0.4.1/tests/__init__.py +1 -0
  68. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_cli.py +3 -1
  69. grai_build-0.4.1/tests/test_migrations_differ.py +635 -0
  70. grai_build-0.4.1/tests/test_migrations_executor.py +706 -0
  71. grai_build-0.4.1/tests/test_migrations_generator.py +698 -0
  72. grai_build-0.3.0/grai_build.egg-info/SOURCES.txt +0 -41
  73. {grai_build-0.3.0 → grai_build-0.4.1}/grai/cli/__init__.py +0 -0
  74. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/__init__.py +0 -0
  75. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/cache/__init__.py +0 -0
  76. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/cache/build_cache.py +0 -0
  77. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/compiler/__init__.py +0 -0
  78. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/compiler/cypher_compiler.py +0 -0
  79. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/exporter/__init__.py +0 -0
  80. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/exporter/ir_exporter.py +0 -0
  81. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/lineage/__init__.py +0 -0
  82. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/lineage/lineage_tracker.py +0 -0
  83. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/loader/__init__.py +0 -0
  84. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/loader/neo4j_loader.py +0 -0
  85. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/parser/__init__.py +0 -0
  86. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/parser/yaml_parser.py +0 -0
  87. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/validator/__init__.py +0 -0
  88. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/validator/validator.py +0 -0
  89. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/visualizer/__init__.py +0 -0
  90. {grai_build-0.3.0 → grai_build-0.4.1}/grai/core/visualizer/visualizer.py +0 -0
  91. {grai_build-0.3.0 → grai_build-0.4.1}/grai/templates/__init__.py +0 -0
  92. {grai_build-0.3.0 → grai_build-0.4.1}/grai_build.egg-info/dependency_links.txt +0 -0
  93. {grai_build-0.3.0 → grai_build-0.4.1}/grai_build.egg-info/entry_points.txt +0 -0
  94. {grai_build-0.3.0 → grai_build-0.4.1}/grai_build.egg-info/top_level.txt +0 -0
  95. {grai_build-0.3.0 → grai_build-0.4.1}/setup.cfg +0 -0
  96. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_cache.py +0 -0
  97. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_compiler.py +0 -0
  98. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_exporter.py +0 -0
  99. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_lineage.py +0 -0
  100. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_loader.py +0 -0
  101. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_models.py +0 -0
  102. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_parser.py +0 -0
  103. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_validator.py +0 -0
  104. {grai_build-0.3.0 → grai_build-0.4.1}/tests/test_visualizer.py +0 -0
@@ -0,0 +1,89 @@
1
+ name: Bug Report
2
+ description: Report a bug or unexpected behavior
3
+ title: "[Bug]: "
4
+ labels: ["bug", "triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to report a bug! Please fill out the form below.
10
+
11
+ - type: textarea
12
+ id: description
13
+ attributes:
14
+ label: Bug Description
15
+ description: A clear description of the bug
16
+ placeholder: What happened?
17
+ validations:
18
+ required: true
19
+
20
+ - type: textarea
21
+ id: reproduction
22
+ attributes:
23
+ label: Steps to Reproduce
24
+ description: Steps to reproduce the behavior
25
+ placeholder: |
26
+ 1. Run `grai init my-project`
27
+ 2. Create entity file with...
28
+ 3. Run `grai validate`
29
+ 4. See error
30
+ validations:
31
+ required: true
32
+
33
+ - type: textarea
34
+ id: expected
35
+ attributes:
36
+ label: Expected Behavior
37
+ description: What did you expect to happen?
38
+ validations:
39
+ required: true
40
+
41
+ - type: textarea
42
+ id: schema
43
+ attributes:
44
+ label: Schema Files (if applicable)
45
+ description: Share relevant YAML schema files
46
+ render: yaml
47
+
48
+ - type: textarea
49
+ id: logs
50
+ attributes:
51
+ label: Error Output / Logs
52
+ description: Paste any error messages or logs
53
+ render: shell
54
+
55
+ - type: dropdown
56
+ id: version
57
+ attributes:
58
+ label: grai.build Version
59
+ description: What version are you using?
60
+ options:
61
+ - 0.3.2
62
+ - 0.3.1
63
+ - 0.3.0
64
+ - Other (specify in description)
65
+ validations:
66
+ required: true
67
+
68
+ - type: dropdown
69
+ id: python
70
+ attributes:
71
+ label: Python Version
72
+ options:
73
+ - "3.12"
74
+ - "3.11"
75
+ - Other
76
+ validations:
77
+ required: true
78
+
79
+ - type: dropdown
80
+ id: os
81
+ attributes:
82
+ label: Operating System
83
+ options:
84
+ - macOS
85
+ - Linux
86
+ - Windows
87
+ - Other
88
+ validations:
89
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Documentation
4
+ url: https://grai.build/
5
+ about: Check out the documentation for guides and references
6
+ - name: Discussions
7
+ url: https://github.com/asantora05/grai.build/discussions
8
+ about: Ask questions and share ideas in GitHub Discussions
@@ -0,0 +1,65 @@
1
+ name: Feature Request
2
+ description: Suggest a new feature or enhancement
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for suggesting a feature! Please describe what you'd like to see.
10
+
11
+ - type: textarea
12
+ id: problem
13
+ attributes:
14
+ label: Problem or Use Case
15
+ description: What problem does this feature solve? What's your use case?
16
+ placeholder: I'm trying to... but currently...
17
+ validations:
18
+ required: true
19
+
20
+ - type: textarea
21
+ id: solution
22
+ attributes:
23
+ label: Proposed Solution
24
+ description: How would you like this to work?
25
+ placeholder: |
26
+ I'd like to be able to...
27
+
28
+ Example:
29
+ ```yaml
30
+ entity: customer
31
+ ...
32
+ ```
33
+ validations:
34
+ required: true
35
+
36
+ - type: textarea
37
+ id: alternatives
38
+ attributes:
39
+ label: Alternatives Considered
40
+ description: Have you considered any alternative solutions or workarounds?
41
+
42
+ - type: dropdown
43
+ id: category
44
+ attributes:
45
+ label: Category
46
+ description: What area does this feature relate to?
47
+ options:
48
+ - Schema Definition (entities/relations)
49
+ - CLI Commands
50
+ - Documentation Generation
51
+ - Migrations
52
+ - Validation
53
+ - Neo4j Integration
54
+ - Visualization / Lineage
55
+ - Other
56
+ validations:
57
+ required: true
58
+
59
+ - type: checkboxes
60
+ id: contribution
61
+ attributes:
62
+ label: Contribution
63
+ description: Would you be willing to contribute this feature?
64
+ options:
65
+ - label: I'd be willing to submit a PR for this feature
@@ -0,0 +1,52 @@
1
+ ## Description
2
+
3
+ <!-- Provide a brief description of your changes -->
4
+
5
+ ## Type of Change
6
+
7
+ <!-- Mark the relevant option with an 'x' -->
8
+
9
+ - [ ] Bug fix (non-breaking change which fixes an issue)
10
+ - [ ] New feature (non-breaking change which adds functionality)
11
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12
+ - [ ] Documentation update
13
+ - [ ] Performance improvement
14
+ - [ ] Code refactoring
15
+ - [ ] Test improvements
16
+
17
+ ## Related Issues
18
+
19
+ <!-- Link to any related issues using #issue-number -->
20
+
21
+ Fixes #
22
+
23
+ ## Checklist
24
+
25
+ - [ ] My code follows the style guidelines of this project
26
+ - [ ] I have performed a self-review of my own code
27
+ - [ ] I have commented my code, particularly in hard-to-understand areas
28
+ - [ ] I have made corresponding changes to the documentation
29
+ - [ ] My changes generate no new warnings
30
+ - [ ] I have added tests that prove my fix is effective or that my feature works
31
+ - [ ] New and existing unit tests pass locally with my changes
32
+ - [ ] Any dependent changes have been merged and published
33
+
34
+ ## Testing
35
+
36
+ <!-- Describe the tests you ran and how to reproduce them -->
37
+
38
+ ```bash
39
+ # Example commands to test your changes
40
+ grai init test-project
41
+ cd test-project
42
+ grai validate
43
+ grai build
44
+ ```
45
+
46
+ ## Screenshots (if applicable)
47
+
48
+ <!-- Add screenshots to help explain your changes -->
49
+
50
+ ## Additional Notes
51
+
52
+ <!-- Add any other context about the PR here -->
@@ -0,0 +1,25 @@
1
+ version: 2
2
+ updates:
3
+ # Python dependencies
4
+ - package-ecosystem: "pip"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ open-pull-requests-limit: 10
9
+ labels:
10
+ - "dependencies"
11
+ - "python"
12
+ commit-message:
13
+ prefix: "chore(deps)"
14
+
15
+ # GitHub Actions
16
+ - package-ecosystem: "github-actions"
17
+ directory: "/"
18
+ schedule:
19
+ interval: "weekly"
20
+ open-pull-requests-limit: 5
21
+ labels:
22
+ - "dependencies"
23
+ - "github-actions"
24
+ commit-message:
25
+ prefix: "chore(deps)"
@@ -0,0 +1,177 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test Python ${{ matrix.python-version }}
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.11", "3.12"]
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v6
20
+
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v6
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+ cache: "pip"
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install -e ".[dev]"
31
+
32
+ - name: Run tests with coverage
33
+ run: |
34
+ pytest --cov=grai --cov-report=xml --cov-report=term-missing
35
+
36
+ - name: Upload coverage to Codecov
37
+ uses: codecov/codecov-action@v5
38
+ with:
39
+ token: ${{ secrets.CODECOV_TOKEN }}
40
+ file: ./coverage.xml
41
+ flags: unittests
42
+ name: codecov-umbrella
43
+ fail_ci_if_error: false
44
+
45
+ lint:
46
+ name: Lint and Format Check
47
+ runs-on: ubuntu-latest
48
+
49
+ steps:
50
+ - name: Checkout code
51
+ uses: actions/checkout@v6
52
+
53
+ - name: Set up Python
54
+ uses: actions/setup-python@v6
55
+ with:
56
+ python-version: "3.11"
57
+ cache: "pip"
58
+
59
+ - name: Install dependencies
60
+ run: |
61
+ python -m pip install --upgrade pip
62
+ pip install -e ".[dev]"
63
+
64
+ - name: Check formatting with Black
65
+ run: black --check grai/
66
+
67
+ - name: Lint with Ruff
68
+ run: ruff check grai/
69
+
70
+ - name: Type check with mypy
71
+ run: mypy grai/
72
+ continue-on-error: true # Don't fail CI on mypy errors initially
73
+
74
+ validate:
75
+ name: Validate Package
76
+ runs-on: ubuntu-latest
77
+
78
+ steps:
79
+ - name: Checkout code
80
+ uses: actions/checkout@v6
81
+
82
+ - name: Set up Python
83
+ uses: actions/setup-python@v6
84
+ with:
85
+ python-version: "3.11"
86
+ cache: "pip"
87
+
88
+ - name: Install dependencies
89
+ run: |
90
+ python -m pip install --upgrade pip
91
+ pip install build twine
92
+
93
+ - name: Build package
94
+ run: python -m build
95
+
96
+ - name: Check package with twine
97
+ run: twine check dist/*
98
+
99
+ - name: Install built package
100
+ run: pip install dist/*.whl
101
+
102
+ - name: Test CLI is available
103
+ run: |
104
+ grai --version
105
+ grai --help
106
+
107
+ integration:
108
+ name: Integration Tests with Neo4j
109
+ runs-on: ubuntu-latest
110
+ services:
111
+ neo4j:
112
+ image: neo4j:5.15
113
+ env:
114
+ NEO4J_AUTH: neo4j/testpassword
115
+ NEO4J_PLUGINS: '["apoc"]'
116
+ ports:
117
+ - 7687:7687
118
+ - 7474:7474
119
+ options: >-
120
+ --health-cmd "cypher-shell -u neo4j -p testpassword 'RETURN 1'"
121
+ --health-interval 10s
122
+ --health-timeout 5s
123
+ --health-retries 5
124
+
125
+ steps:
126
+ - name: Checkout code
127
+ uses: actions/checkout@v6
128
+
129
+ - name: Set up Python
130
+ uses: actions/setup-python@v6
131
+ with:
132
+ python-version: "3.11"
133
+ cache: "pip"
134
+
135
+ - name: Install dependencies
136
+ run: |
137
+ python -m pip install --upgrade pip
138
+ pip install -e ".[dev]"
139
+
140
+ - name: Wait for Neo4j
141
+ run: |
142
+ timeout 60 bash -c 'until cypher-shell -u neo4j -p testpassword -a bolt://localhost:7687 "RETURN 1"; do sleep 2; done' || true
143
+
144
+ - name: Test grai init
145
+ run: |
146
+ mkdir test-project
147
+ cd test-project
148
+ grai init --name test-graph
149
+
150
+ - name: Test grai validate
151
+ run: |
152
+ cd test-project
153
+ grai validate
154
+
155
+ - name: Test grai build
156
+ run: |
157
+ cd test-project
158
+ grai build
159
+
160
+ - name: Test grai run with Neo4j
161
+ run: |
162
+ cd test-project
163
+ grai run --uri bolt://localhost:7687 --user neo4j --password testpassword --schema-only
164
+
165
+ - name: Test grai docs
166
+ run: |
167
+ cd test-project
168
+ grai docs --output ./docs-output
169
+
170
+ - name: Verify docs were generated
171
+ run: |
172
+ cd test-project
173
+ test -f docs-output/index.html
174
+ test -f docs-output/entities.html
175
+ test -f docs-output/relations.html
176
+ test -f docs-output/graph.html
177
+ test -f docs-output/lineage.html
@@ -0,0 +1,92 @@
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - "docs/**"
9
+ - "mkdocs.yml"
10
+ - ".github/workflows/docs.yml"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: write
15
+
16
+ jobs:
17
+ deploy:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v6
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.11"
28
+
29
+ - name: Cache dependencies
30
+ uses: actions/cache@v5
31
+ with:
32
+ path: ~/.cache/pip
33
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-docs.txt') }}
34
+ restore-keys: |
35
+ ${{ runner.os }}-pip-
36
+
37
+ - name: Install dependencies
38
+ run: |
39
+ pip install --upgrade pip
40
+ pip install -r requirements-docs.txt
41
+
42
+ - name: Build MkDocs site
43
+ run: mkdocs build --clean --verbose
44
+
45
+ - name: Create Firebase configuration
46
+ run: |
47
+ cat > firebase.json << 'EOF'
48
+ {
49
+ "hosting": {
50
+ "public": "site",
51
+ "ignore": [
52
+ "firebase.json",
53
+ "**/.*",
54
+ "**/node_modules/**"
55
+ ],
56
+ "cleanUrls": true,
57
+ "trailingSlash": false,
58
+ "rewrites": [
59
+ {
60
+ "source": "**",
61
+ "destination": "/404.html"
62
+ }
63
+ ],
64
+ "headers": [
65
+ {
66
+ "source": "**/*.@(jpg|jpeg|gif|png|svg|webp)",
67
+ "headers": [
68
+ {
69
+ "key": "Cache-Control",
70
+ "value": "max-age=604800"
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "source": "**/*.@(css|js)",
76
+ "headers": [
77
+ {
78
+ "key": "Cache-Control",
79
+ "value": "max-age=604800"
80
+ }
81
+ ]
82
+ }
83
+ ]
84
+ }
85
+ }
86
+ EOF
87
+
88
+ - name: Install Firebase CLI
89
+ run: npm install -g firebase-tools
90
+
91
+ - name: Deploy to Firebase Hosting
92
+ run: firebase deploy --only hosting --project "${{ secrets.FIREBASE_PROJECT_ID }}" --token "${{ secrets.FIREBASE_TOKEN }}"
@@ -0,0 +1,146 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ version:
10
+ description: "Version to release (e.g., 0.3.0)"
11
+ required: true
12
+
13
+ permissions:
14
+ contents: write
15
+ id-token: write
16
+
17
+ jobs:
18
+ test:
19
+ name: Run Full Test Suite
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v6
25
+
26
+ - name: Set up Python
27
+ uses: actions/setup-python@v6
28
+ with:
29
+ python-version: "3.11"
30
+ cache: "pip"
31
+
32
+ - name: Install dependencies
33
+ run: |
34
+ python -m pip install --upgrade pip
35
+ pip install -e ".[dev]"
36
+
37
+ - name: Run all tests
38
+ run: pytest -v
39
+
40
+ build:
41
+ name: Build Distribution
42
+ needs: test
43
+ runs-on: ubuntu-latest
44
+
45
+ steps:
46
+ - name: Checkout code
47
+ uses: actions/checkout@v6
48
+
49
+ - name: Set up Python
50
+ uses: actions/setup-python@v6
51
+ with:
52
+ python-version: "3.11"
53
+ cache: "pip"
54
+
55
+ - name: Install build dependencies
56
+ run: |
57
+ python -m pip install --upgrade pip
58
+ pip install build twine
59
+
60
+ - name: Build package
61
+ run: python -m build
62
+
63
+ - name: Check distribution
64
+ run: twine check dist/*
65
+
66
+ - name: Upload artifacts
67
+ uses: actions/upload-artifact@v6
68
+ with:
69
+ name: dist
70
+ path: dist/
71
+
72
+ publish-test-pypi:
73
+ name: Publish to Test PyPI
74
+ needs: build
75
+ runs-on: ubuntu-latest
76
+ environment:
77
+ name: test-pypi
78
+ url: https://test.pypi.org/project/grai-build/
79
+
80
+ steps:
81
+ - name: Download artifacts
82
+ uses: actions/download-artifact@v7
83
+ with:
84
+ name: dist
85
+ path: dist/
86
+
87
+ - name: Publish to Test PyPI
88
+ uses: pypa/gh-action-pypi-publish@release/v1
89
+ with:
90
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
91
+ repository-url: https://test.pypi.org/legacy/
92
+ skip-existing: true
93
+
94
+ publish-pypi:
95
+ name: Publish to PyPI
96
+ needs: publish-test-pypi
97
+ runs-on: ubuntu-latest
98
+ environment:
99
+ name: pypi
100
+ url: https://pypi.org/project/grai-build/
101
+
102
+ steps:
103
+ - name: Download artifacts
104
+ uses: actions/download-artifact@v7
105
+ with:
106
+ name: dist
107
+ path: dist/
108
+
109
+ - name: Publish to PyPI
110
+ uses: pypa/gh-action-pypi-publish@release/v1
111
+ with:
112
+ password: ${{ secrets.PYPI_API_TOKEN }}
113
+
114
+ create-release:
115
+ name: Create GitHub Release
116
+ needs: publish-pypi
117
+ runs-on: ubuntu-latest
118
+
119
+ steps:
120
+ - name: Checkout code
121
+ uses: actions/checkout@v6
122
+
123
+ - name: Download artifacts
124
+ uses: actions/download-artifact@v7
125
+ with:
126
+ name: dist
127
+ path: dist/
128
+
129
+ - name: Extract version from tag
130
+ id: get_version
131
+ run: |
132
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
133
+ echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
134
+ else
135
+ echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
136
+ fi
137
+
138
+ - name: Create Release
139
+ uses: softprops/action-gh-release@v2
140
+ with:
141
+ tag_name: v${{ steps.get_version.outputs.VERSION }}
142
+ name: Release ${{ steps.get_version.outputs.VERSION }}
143
+ draft: false
144
+ prerelease: false
145
+ generate_release_notes: true
146
+ files: dist/*