-
Notifications
You must be signed in to change notification settings - Fork 366
Workflow to build python CLI snapshot for nightly publishing (sdist + wheels) #3036
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
79fdef4
Add artifact build pipeline
HonahX 2b1d3dc
fix license
HonahX 46d1e77
Fix format
HonahX 87d6409
Fix nit and format issue
HonahX de01a6c
Simplify build file
HonahX 6557cce
Remove the need of cibuildwheel
HonahX 927782e
Remove unnecessary step
HonahX f5c52e3
Simplify workflow to focus on snapshot builds only
HonahX 96ef5b5
Simplify snapshot version generation
HonahX eca2d97
Fix the github action commits
HonahX 15c4274
Fix version issue
HonahX 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
Some comments aren't visible on the classic Files Changed page.
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,131 @@ | ||
| # | ||
| # 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: "Python Client Build Snapshot Artifacts" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| outputs: | ||
| artifact-name: | ||
| description: "Name of the merged artifact containing all wheels and sdist" | ||
| value: ${{ jobs.merge-artifacts.outputs.artifact-name }} | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/python-client-build-artifacts.yml' | ||
| - 'client/python/**' | ||
|
|
||
| jobs: | ||
| generate-version: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| - name: Install Poetry | ||
| run: make client-install-poetry | ||
|
|
||
| - name: Generate snapshot version | ||
| id: version | ||
| run: | | ||
| CURRENT_VERSION=$(make client-get-version) | ||
| DATE_SUFFIX=$(date -u +%Y%m%d%H%M%S) | ||
| NIGHTLY_VERSION="${CURRENT_VERSION}.dev${DATE_SUFFIX}" | ||
| echo "version=$NIGHTLY_VERSION" >> $GITHUB_OUTPUT | ||
| echo "Generated snapshot version: $NIGHTLY_VERSION" | ||
|
|
||
| build-artifacts: | ||
| name: Build artifacts on ${{ matrix.os }} with Python ${{ matrix.python-version }} | ||
| runs-on: ${{ matrix.os }} | ||
| needs: generate-version | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-24.04, macos-14, macos-15] | ||
| python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Set up JDK for openapi-generator-cli | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '21' | ||
|
|
||
| - name: Set snapshot version | ||
| run: | | ||
| echo "Setting version to: ${{ needs.generate-version.outputs.version }}" | ||
| make client-set-version VERSION="${{ needs.generate-version.outputs.version }}" | ||
|
|
||
| - name: Build source distribution | ||
| if: matrix.python-version == '3.13' && startsWith(matrix.os, 'ubuntu-24.04') | ||
| run: | | ||
| make client-build FORMAT=sdist | ||
|
|
||
| - name: Build wheel | ||
| run: | | ||
| make client-build FORMAT=wheel | ||
|
|
||
| - name: Prepare artifacts directory | ||
| run: | | ||
| mkdir -p wheelhouse | ||
| cp ./client/python/dist/*.whl wheelhouse/ | ||
|
|
||
| - name: Add source distribution | ||
| if: matrix.python-version == '3.13' && startsWith(matrix.os, 'ubuntu-24.04') | ||
| run: cp ./client/python/dist/*.tar.gz wheelhouse/ | ||
|
|
||
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | ||
| with: | ||
| name: python-client-artifacts-${{ matrix.os }}-${{ matrix.python-version }} | ||
| path: ./wheelhouse/* | ||
|
|
||
| merge-artifacts: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - generate-version | ||
| - build-artifacts | ||
| outputs: | ||
| artifact-name: ${{ steps.output-name.outputs.artifact-name }} | ||
| steps: | ||
| - name: Merge Artifacts | ||
| uses: actions/upload-artifact/merge@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | ||
| with: | ||
| name: python-client-artifacts-${{ needs.generate-version.outputs.version }} | ||
| pattern: python-client-artifacts-* | ||
| delete-merged: true | ||
|
|
||
| - name: Output artifact name | ||
| id: output-name | ||
| run: echo "artifact-name=python-client-artifacts-${{ needs.generate-version.outputs.version }}" >> $GITHUB_OUTPUT | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.