diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c6997a88 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Shell scripts must use LF line endings to run on Linux CI runners +dev/check-license eol=lf diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0f72f9fe..626e6235 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -39,6 +39,7 @@ ### Converters - [ ] Converter logic in `converters/` is updated to reflect spec or ontology changes - [ ] New converters include tests under the converter's test directory +- [ ] If adding a new converter, `.github/labeler.yml` is updated with the new path ### Validation - [ ] Validation rules in `validation/` are updated if the spec changed @@ -58,4 +59,5 @@ ### Compliance - [ ] ASF license headers are present on all new source files -- [ ] No third-party dependencies are added without PMC/IPMC approval \ No newline at end of file +- [ ] No third-party dependencies are added without PMC/IPMC approval +- [ ] If third-party source code is vendored/copied (not just declared as a dependency), `NOTICE` and/or `LICENSE` have been updated per [ASF policy](https://infra.apache.org/licensing-howto.html) diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..513dc7b3 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,112 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Catch-all: any converter change gets this label (including new converters) +converter: + - changed-files: + - any-glob-to-any-file: 'converters/**' + +# Specific converter labels +converter/dbt: + - changed-files: + - any-glob-to-any-file: 'converters/dbt/**' + +converter/databricks: + - changed-files: + - any-glob-to-any-file: 'converters/databricks/**' + +converter/gooddata: + - changed-files: + - any-glob-to-any-file: 'converters/gooddata/**' + +converter/honeydew: + - changed-files: + - any-glob-to-any-file: 'converters/honeydew/**' + +converter/omni: + - changed-files: + - any-glob-to-any-file: 'converters/omni/**' + +converter/orionbelt: + - changed-files: + - any-glob-to-any-file: 'converters/orionbelt/**' + +converter/polaris: + - changed-files: + - any-glob-to-any-file: 'converters/polaris/**' + +converter/salesforce: + - changed-files: + - any-glob-to-any-file: 'converters/salesforce/**' + +converter/snowflake: + - changed-files: + - any-glob-to-any-file: 'converters/snowflake/**' + +converter/wisdom: + - changed-files: + - any-glob-to-any-file: 'converters/wisdom/**' + +converter/sigma: + - changed-files: + - any-glob-to-any-file: 'converters/sigma/**' + +converter/microsoft: + - changed-files: + - any-glob-to-any-file: 'converters/microsoft/**' + +converter/nvidia: + - changed-files: + - any-glob-to-any-file: 'converters/nvidia/**' + +converter/ontology: + - changed-files: + - any-glob-to-any-file: 'converters/ontology/**' + +# Other areas +cli: + - changed-files: + - any-glob-to-any-file: 'cli/**' + +spec: + - changed-files: + - any-glob-to-any-file: 'core-spec/**' + +ontology: + - changed-files: + - any-glob-to-any-file: 'ontology/**' + +docs: + - changed-files: + - any-glob-to-any-file: 'docs/**' + +validation: + - changed-files: + - any-glob-to-any-file: 'validation/**' + +examples: + - changed-files: + - any-glob-to-any-file: 'examples/**' + +infra: + - changed-files: + - any-glob-to-any-file: + - '.github/**' + - '.asf.yaml' + - 'Makefile' + - '.pre-commit-config.yaml' + - 'ruff.toml' diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml new file mode 100644 index 00000000..be2ff404 --- /dev/null +++ b/.github/workflows/auto-label-issues.yml @@ -0,0 +1,60 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Auto Label New Issues + +on: + issues: + types: [opened] + +permissions: + issues: write + +jobs: + label: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const label = 'needs-triage'; + try { + await github.rest.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label + }); + } catch (e) { + if (e.status === 404) { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label, + color: 'e11d48', + description: 'Issue needs triage by a maintainer' + }); + } else { + throw e; + } + } + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: [label] + }); diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml new file mode 100644 index 00000000..d80918b4 --- /dev/null +++ b/.github/workflows/auto-label-prs.yml @@ -0,0 +1,64 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Auto Label PRs + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + label-by-files: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const content = fs.readFileSync('.github/labeler.yml', 'utf8'); + const labels = content.split('\n') + .filter(line => /^\S.*:/.test(line) && !line.startsWith('#')) + .map(line => line.split(':')[0].trim()); + for (const name of labels) { + try { + await github.rest.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name + }); + } catch (e) { + if (e.status === 404) { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name, + color: '0e8a16' + }); + } + } + } + - uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + sync-labels: true diff --git a/.github/workflows/community-pr-helper.yml b/.github/workflows/community-pr-helper.yml new file mode 100644 index 00000000..ad08e080 --- /dev/null +++ b/.github/workflows/community-pr-helper.yml @@ -0,0 +1,65 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Community PR Helper + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + +jobs: + welcome: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + // Only greet first-time contributors — search for prior PRs by this author + const author = context.payload.pull_request.user.login; + const { data: result } = await github.rest.search.issuesAndPullRequests({ + q: `is:pr repo:${context.repo.owner}/${context.repo.repo} author:${author}` + }); + + if (result.total_count > 1) { + console.log('Not a first-time contributor, skipping welcome.'); + return; + } + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: [ + 'Thank you for your first contribution to Apache Ossie (incubating)!', + '', + 'A committer will review your PR. In the meantime, please ensure:', + '', + '- All CI checks pass', + '- ASF license headers are present on new source files', + '- Tests cover new functionality', + '', + 'No ICLA is required to contribute. If you are elected as a committer in the future, you will need an [Individual Contributor License Agreement (ICLA)](https://www.apache.org/licenses/contributor-agreements.html) on file with the ASF.', + '', + '**Questions?** Ask in the PR comments or join us on [Slack](https://join.slack.com/t/apache-ossie/shared_invite/zt-42zw4rflt-Gpve8_NFJq7AsdAQTY~SCg).', + '', + 'We appreciate your contribution!' + ].join('\n') + }); diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..c9e96095 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Dependency Review + +# Note: For fork-originated PRs, the GITHUB_TOKEN is read-only. +# The dependency scan still runs but the PR summary comment will be skipped. +on: [pull_request] + +permissions: + contents: read + pull-requests: write + +jobs: + dependency-review: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/dependency-review-action@v4 + with: + deny-licenses: GPL-1.0-only, GPL-1.0-or-later, GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later, LGPL-2.0-only, LGPL-2.0-or-later, LGPL-2.1-only, LGPL-2.1-or-later, LGPL-3.0-only, LGPL-3.0-or-later, AGPL-1.0-only, AGPL-1.0-or-later, AGPL-3.0-only, AGPL-3.0-or-later, SSPL-1.0, EUPL-1.1, EUPL-1.2 + comment-summary-in-pr: always diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml new file mode 100644 index 00000000..f9764689 --- /dev/null +++ b/.github/workflows/license-check.yml @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: License Header Check + +on: + pull_request: + +permissions: + contents: read + +jobs: + rat: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Run Apache RAT + run: dev/check-license diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 00000000..4bf68c68 --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: PR Title Check + +on: + pull_request: + types: [opened, edited, reopened] + +permissions: + contents: read + +jobs: + check-pr-title: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + env: + PR_TITLE: ${{ github.event.pull_request.title }} + steps: + - name: Check PR title format + run: | + # Enforce "Area: Description" or "type(scope): description" format + # Examples: "Converter/dbt: Add metric support", "fix(dbt): correct round-trip", "CLI: Fix plugin listing" + PATTERN='^(Revert ")?[A-Za-z][A-Za-z0-9._+/&,()-]*( [A-Za-z0-9][A-Za-z0-9._+/&,()-]*)*: .+' + if ! echo "$PR_TITLE" | grep -Eq "$PATTERN"; then + echo "::error::PR title must follow 'Area: Description' or 'type(scope): description' format." + echo "" + echo "Examples:" + echo " Converter/dbt: Add metric support" + echo " fix(dbt): correct round-trip for PERCENTILE" + echo " docs(core-spec): clarify operator precedence" + echo " CLI: Fix plugin listing" + echo " Infra: Add community workflows" + echo "" + echo "Valid patterns: Area:, Area/sub:, type(scope):" + exit 1 + fi diff --git a/.github/workflows/remove-awaiting-response.yml b/.github/workflows/remove-awaiting-response.yml new file mode 100644 index 00000000..30e663ff --- /dev/null +++ b/.github/workflows/remove-awaiting-response.yml @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Remove Awaiting Response Label + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request: + types: [synchronize] + +permissions: + issues: write + pull-requests: write + +jobs: + remove-awaiting-response: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const issue = context.issue || context.payload.pull_request; + const commenter = context.payload.comment?.user.login || context.payload.sender.login; + const issueAuthor = context.payload.issue?.user.login || context.payload.pull_request?.user.login; + + if (commenter === issueAuthor) { + const { data: labels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number + }); + + const hasLabel = labels.some(l => l.name === 'awaiting-response'); + + if (hasLabel) { + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + name: 'awaiting-response' + }).catch(() => {}); + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: ['needs-review'] + }).catch(() => {}); + } + } diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..446a618e --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,67 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Close Stale Issues and PRs + +on: + schedule: + - cron: '0 0 * * 0' # Weekly on Sunday midnight UTC + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + days-before-issue-stale: 90 + days-before-issue-close: -1 + stale-issue-label: 'stale' + only-issue-labels: 'awaiting-response' + stale-issue-message: > + This issue has been automatically marked as stale because it has been + waiting for a response for 90 days. + + If this is still relevant, please provide the requested information or + comment to keep it open. You can also reach out on the dev@ossie.apache.org + mailing list. + + days-before-pr-stale: 60 + days-before-pr-close: -1 + stale-pr-label: 'stale' + only-pr-labels: 'awaiting-response' + stale-pr-message: > + This pull request has been marked as stale because the requested + changes or feedback have not been addressed for 60 days. + + To keep this PR active, please address the review comments or respond + to questions from reviewers. + + exempt-issue-labels: 'priority:critical,security,good-first-issue,in-progress,needs-review,needs-triage' + exempt-pr-labels: 'priority:critical,security,in-progress,needs-review' + exempt-all-issue-assignees: true + exempt-all-pr-assignees: true + exempt-all-issue-milestones: true + exempt-all-pr-milestones: true + operations-per-run: 100 diff --git a/.gitignore b/.gitignore index 136e4e9a..f6a84d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ cli/dist/ cli/ossie cli/.tool-versions + +# Apache RAT (downloaded by dev/check-license) +dev/lib/ diff --git a/converters/cube/tests/fixtures/databricks_ossie.yaml b/converters/cube/tests/fixtures/databricks_ossie.yaml index bc571635..0e8c607b 100644 --- a/converters/cube/tests/fixtures/databricks_ossie.yaml +++ b/converters/cube/tests/fixtures/databricks_ossie.yaml @@ -1,4 +1,19 @@ # Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. # An Ossie model as the Databricks converter emits one, which differs from a # Cube-authored document in two ways that matter here: # diff --git a/converters/sigma/LIMITATIONS.md b/converters/sigma/LIMITATIONS.md index 3270be40..b8558085 100644 --- a/converters/sigma/LIMITATIONS.md +++ b/converters/sigma/LIMITATIONS.md @@ -1,3 +1,22 @@ + + # Limitations and design tradeoffs What `converters/sigma` does not map onto a portable Ossie concept, and why. Every diff --git a/converters/sigma/README.md b/converters/sigma/README.md index d4fb117c..26d81cfc 100644 --- a/converters/sigma/README.md +++ b/converters/sigma/README.md @@ -1,3 +1,22 @@ + + # apache-ossie-sigma Converts between [Sigma Computing](https://www.sigmacomputing.com/) Data Models (the diff --git a/dev/.rat-excludes b/dev/.rat-excludes new file mode 100644 index 00000000..49b26fb7 --- /dev/null +++ b/dev/.rat-excludes @@ -0,0 +1,67 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Files excluded from Apache RAT license header checks. +# Keep this list minimal — only exclude files where a license header +# is impossible or inappropriate (binary, generated, third-party). + +# Binary and generated files +**/*.png +**/*.jpg +**/*.ico +**/*.woff +**/*.woff2 + +# Lock files and dependency manifests +**/*.lock +**/go.sum + +# Data/config files that cannot contain comments +**/*.json +**/*.csv + +# Microsoft BI fixture formats (TOM/BIM/TMDL treat leading lines as object descriptions) +**/*.bim +**/*.ipynb +converters/microsoft/tests/fixtures/sales_model.tmdl + +# Snapshot/fixture test files +**/snapshots/** +**/__snapshots__/** + +# Git and IDE +.git/** +.idea/** +.vscode/** +**/.gitignore + +# Build output +**/build/** +**/dist/** +**/*.egg-info/** +**/__pycache__/** +**/node_modules/** +**/.venv/** +**/target/** + +# Files that are themselves license/notice +**/LICENSE +**/NOTICE + +# Specific project files +.editorconfig +.python-version diff --git a/dev/check-license b/dev/check-license new file mode 100755 index 00000000..9c30d4d0 --- /dev/null +++ b/dev/check-license @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Checks that all source files contain the ASF license header +# using Apache RAT (Release Audit Tool). + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +RAT_VERSION="0.17" +RAT_JAR="$SCRIPT_DIR/lib/apache-rat-${RAT_VERSION}.jar" +RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" + +# Download RAT if not cached +if [ ! -f "$RAT_JAR" ]; then + echo "Downloading Apache RAT ${RAT_VERSION}..." + mkdir -p "$SCRIPT_DIR/lib" + curl -sSfL -o "$RAT_JAR" "$RAT_URL" +fi + +# Ensure Java is available +if ! command -v java &> /dev/null; then + echo "ERROR: Java is required to run Apache RAT." + echo "Install Java 11+ and ensure it is on PATH." + exit 1 +fi + +echo "Running Apache RAT license header check..." +java -jar "$RAT_JAR" \ + --input-exclude-file "$SCRIPT_DIR/.rat-excludes" \ + --input-exclude-std GIT IDEA MAC \ + --output-style missing-headers \ + --log-level ERROR \ + -- "$REPO_DIR" + +echo "License header check passed."