-
Notifications
You must be signed in to change notification settings - Fork 80
Add workflows for Python, Go, and Bazel ecosystems #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mmorel-35
wants to merge
1
commit into
cncf:main
Choose a base branch
from
mmorel-35:versioning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "homepage": "https://github.com/cncf/xds", | ||
| "maintainers": [ | ||
| { | ||
| "name": "Adi Peleg", | ||
| "github_user_id": 4787431, | ||
| "github": "adisuissa" | ||
| }, | ||
| { | ||
| "github_user_id": 454682, | ||
| "github": "phlax" | ||
| } | ||
| ], | ||
| "repository": [ | ||
| "github:cncf/xds" | ||
| ], | ||
| "versions": [], | ||
| "yanked_versions": {} | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| matrix: | ||
| platform: | ||
| - macos | ||
| - ubuntu2204 | ||
| bazel: | ||
| - 7.x | ||
| - 8.x | ||
| - 9.x | ||
| tasks: | ||
| verify_targets: | ||
| name: "Verify build targets" | ||
| platform: ${{ platform }} | ||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - "@xds//..." | ||
| test_targets: | ||
| - "@xds//..." |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "integrity": "", | ||
| "strip_prefix": "xds-{VERSION}", | ||
| "url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: github-actions | ||
| directory: / | ||
| schedule: | ||
| interval: "weekly" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Go Module Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Verify and Test Go Module | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: Verify Go module | ||
| working-directory: go | ||
| run: | | ||
| go mod verify | ||
| go mod tidy | ||
| go build ./... | ||
|
|
||
| - name: Run Go tests | ||
| working-directory: go | ||
| run: go test ./... -v | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Publish to BCR | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish to Bazel Central Registry | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| attestations: write | ||
| uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@0bd40ad4f872b4d216d3f01bc0844ade304e2b5a # v1.1.0 | ||
| with: | ||
| tag_name: ${{ github.ref_name }} | ||
| draft: false | ||
| secrets: | ||
| publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Python Package Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Build and Publish Python Package | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/cncf-xds | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install build | ||
|
|
||
| - name: Build package | ||
| working-directory: python | ||
| run: python -m build | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will require some creds surely |
||
| with: | ||
| packages-dir: python/dist/ | ||
|
|
||
| - name: Upload Python artifacts to release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| gh release upload "${{ github.ref_name }}" python/dist/* | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Create Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| create-release: | ||
| name: Create GitHub Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - name: Extract version from tag | ||
| id: version | ||
| run: | | ||
| VERSION=${GITHUB_REF#refs/tags/v} | ||
| echo "number=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| cat > "$RUNNER_TEMP/release-notes.md" << 'EOF' | ||
| # xDS Release ${{ github.ref_name }} | ||
|
|
||
| This release includes updates for all language bindings: | ||
|
|
||
| ## Python (PyPI) | ||
| ```bash | ||
| pip install cncf-xds==${{ steps.version.outputs.number }} | ||
| ``` | ||
|
|
||
| ## Go Module | ||
| ```bash | ||
| go get github.com/cncf/xds/go@${{ github.ref_name }} | ||
| ``` | ||
|
|
||
| ## Bazel (BCR) | ||
| ```starlark | ||
| bazel_dep(name = "xds", version = "${{ steps.version.outputs.number }}") | ||
| ``` | ||
| EOF | ||
|
|
||
| gh release create "${{ github.ref_name }}" \ | ||
| --title "Release ${{ github.ref_name }}" \ | ||
| --notes-file "$RUNNER_TEMP/release-notes.md" \ | ||
| --generate-notes | ||
|
|
||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: Version Bump | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'New version (e.g., 1.2.3)' | ||
| required: true | ||
| type: string | ||
| create_tag: | ||
| description: 'Create and push tag' | ||
| required: true | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| bump-version: | ||
| name: Bump Version | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Configure Git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Update Python version | ||
| working-directory: python | ||
| run: | | ||
| sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml | ||
| cat pyproject.toml | ||
|
|
||
| - name: Update Go version (create VERSION file) | ||
| working-directory: go | ||
| run: | | ||
| echo "${{ inputs.version }}" > VERSION | ||
| cat VERSION | ||
|
|
||
| - name: Update Bazel version | ||
| run: | | ||
| sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" MODULE.bazel | ||
| cat MODULE.bazel | ||
|
|
||
| - name: Commit version changes | ||
| run: | | ||
| git add . | ||
| git commit -m "chore: bump version to ${{ inputs.version }}" | ||
| git push | ||
|
|
||
| - name: Create and push tag | ||
| if: inputs.create_tag | ||
| run: | | ||
| TAG_NAME="v${{ inputs.version }}" | ||
| git tag -a "$TAG_NAME" -m "Release version ${{ inputs.version }}" | ||
| git push origin "$TAG_NAME" | ||
| echo "Created and pushed tag: $TAG_NAME" | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,14 @@ | ||
| bazel-* | ||
| MODULE.bazel.lock | ||
| __pycache__/ | ||
| __pycache__/ | ||
|
|
||
| # Python build artifacts | ||
| python/dist/ | ||
| python/build/ | ||
| python/*.egg-info/ | ||
| *.pyc | ||
| *.pyo | ||
| *.pyd | ||
| .Python | ||
| env/ | ||
| venv/ |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this already setup for this repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I know