-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Update build/release workflows #8
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c86c825
Update remaining workflows to work with new package structure/repo
spalmurray b6df7c7
Try using Sentry release bot for create_release_pr.yml
spalmurray ded77d9
Use sentry bot auth token for create_release.yml
spalmurray a53bd9f
Set release: false in release_flow while testing things
spalmurray 14eb56e
Add temp test workflow
spalmurray e5180c9
ubuntu-20.04 -> ubuntu-22.04
spalmurray ad3d7df
Update wheelhouse path
spalmurray d013c37
Remove test workflow
spalmurray 02bc9a4
Test the bot user auth flow
spalmurray 23db0d2
Oops
spalmurray 3b8bcc9
Add bot's git info
spalmurray 8bd68e7
Update committer info to be the gh app not the bot account
spalmurray b0e2965
Remove testing stuff, finalize create_release_pr.yml details
spalmurray 456a3df
Update build_assets to use release bot auth
spalmurray 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,164 @@ | ||
| --- | ||
| name: Build Compiled Assets | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| release: | ||
| type: boolean | ||
| default: false | ||
| description: "Attach artifacts to a release" | ||
|
|
||
| jobs: | ||
| build_assets: | ||
| name: Build packages - ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| include: | ||
| - os: macos-latest | ||
| TARGET: macos | ||
| # currently, wrapt pulls the arm64 version instead of the universal one, so the below is a hack | ||
| CMD_REQS: > | ||
| mkdir -p pip-packages && cd pip-packages && pip wheel --no-cache-dir --no-binary tree_sitter,ijson,charset_normalizer,PyYAML .. && | ||
| rm $(ls | grep wrapt) && pip download wrapt --platform=universal2 --only-binary=:all: && pip install $(ls | grep wrapt) --force-reinstall && cd .. && | ||
| pip install --no-deps --no-index --find-links=pip-packages pip-packages/* | ||
| CMD_BUILD: > | ||
| STATICCODECOV_LIB_PATH=$(find build/ -maxdepth 1 -type d -name 'lib.*' -print -quit | xargs -I {} sh -c "find {} -type f -name 'staticcodecov*' -print -quit | sed 's|^./||'") && | ||
| pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages --target-arch universal2 -F codecov_cli/main.py && | ||
| mv dist/main dist/codecovcli_macos && | ||
| lipo -archs dist/codecovcli_macos | grep 'x86_64 arm64' | ||
| OUT_FILE_NAME: codecovcli_macos | ||
| ASSET_MIME: application/octet-stream | ||
|
|
||
| - os: ubuntu-22.04 | ||
| TARGET: ubuntu | ||
| CMD_REQS: > | ||
| pip install -r requirements.txt && pip install . | ||
| CMD_BUILD: > | ||
| STATICCODECOV_LIB_PATH=$(find build/ -maxdepth 1 -type d -name 'lib.*' -print -quit | xargs -I {} sh -c "find {} -type f -name 'staticcodecov*' -print -quit | sed 's|^./||'") && | ||
| pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli/main.py && | ||
| cp ./dist/main ./dist/codecovcli_linux | ||
| OUT_FILE_NAME: codecovcli_linux | ||
| ASSET_MIME: application/octet-stream | ||
|
|
||
| - os: windows-latest | ||
| TARGET: windows | ||
| CMD_REQS: > | ||
| pip install -r requirements.txt && pip install . | ||
| CMD_BUILD: > | ||
| pyinstaller --add-binary "build\lib.win-amd64-cpython-311\staticcodecov_languages.cp311-win_amd64.pyd;." --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli\main.py && | ||
| Copy-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe" | ||
| OUT_FILE_NAME: codecovcli_windows.exe | ||
| ASSET_MIME: application/vnd.microsoft.portable-executable | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v3 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| cd codecov-cli | ||
| ${{matrix.CMD_REQS}} | ||
| python setup.py build | ||
|
|
||
| - name: Install pyinstaller | ||
| run: pip install pyinstaller | ||
|
|
||
| - name: Build with pyinstaller for ${{matrix.TARGET}} | ||
| run: cd codecov-cli && ${{matrix.CMD_BUILD}} | ||
|
|
||
| - name: Upload a Build Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| if: inputs.release == false | ||
| with: | ||
| name: ${{ matrix.OUT_FILE_NAME }} | ||
| path: ./codecov-cli/dist/${{ matrix.OUT_FILE_NAME }} | ||
|
|
||
| - name: Get auth token | ||
| if: inputs.release == true | ||
| id: token | ||
| uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 | ||
| with: | ||
| app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} | ||
| private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} | ||
|
|
||
| - name: Upload Release Asset | ||
| if: inputs.release == true | ||
| id: upload-release-asset | ||
| uses: svenstaro/upload-release-action@v2 | ||
| with: | ||
| repo_token: ${{ steps.token.outputs.token }} | ||
| file: ./codecov-cli/dist/${{ matrix.OUT_FILE_NAME }} | ||
| asset_name: ${{ matrix.OUT_FILE_NAME }} | ||
| tag: ${{ github.ref }} | ||
| overwrite: true | ||
|
|
||
| build_assets_alpine_arm: | ||
| name: Build assets - Alpine and ARM | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - distro: "python:3.11-alpine3.18" | ||
| arch: arm64 | ||
| distro_name: alpine | ||
| - distro: "python:3.11-alpine3.18" | ||
| arch: x86_64 | ||
| distro_name: alpine | ||
| - distro: "python:3.11-bullseye" | ||
| arch: arm64 | ||
| distro_name: linux | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v1 | ||
| with: | ||
| platforms: ${{ matrix.arch }} | ||
|
|
||
| - name: Run in Docker | ||
| run: | | ||
| docker run \ | ||
| --rm \ | ||
| -v $(pwd):/${{ github.workspace }} \ | ||
| -w ${{ github.workspace }} \ | ||
| --platform linux/${{ matrix.arch }} \ | ||
| ${{ matrix.distro }} \ | ||
| ./codecov-cli/scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }} | ||
|
|
||
| - name: Upload a Build Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| if: inputs.release == false | ||
| with: | ||
| name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} | ||
| path: ./codecov-cli/dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} | ||
|
|
||
| - name: Get auth token | ||
| if: inputs.release == true | ||
| id: token | ||
| uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 | ||
| with: | ||
| app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} | ||
| private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} | ||
|
|
||
| - name: Upload Release Asset | ||
| if: inputs.release == true | ||
| id: upload-release-asset | ||
| uses: svenstaro/upload-release-action@v2 | ||
| with: | ||
| repo_token: ${{ steps.token.outputs.token }} | ||
| file: ./codecov-cli/dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} | ||
| asset_name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} | ||
| tag: ${{ github.ref }} | ||
| overwrite: true | ||
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,71 @@ | ||
| --- | ||
| name: Build for PyPi | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| publish: | ||
| type: boolean | ||
| default: false | ||
| description: "Build for PyPi" | ||
|
|
||
| jobs: | ||
| build_src_for_pypi: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| submodules: true | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install build | ||
|
|
||
| - name: Build src dist | ||
| run: | | ||
| cd codecov-cli | ||
| python -m build --sdist | ||
| env: | ||
| PIP_CONSTRAINT: requirements.txt | ||
|
|
||
| - name: Store the distribution packages | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-sdist | ||
| path: ./**/*.tar.gz | ||
|
|
||
| build_dist_for_pypi: | ||
| needs: | ||
| - build_src_for_pypi | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - macos-13 | ||
| - macos-latest | ||
| - ubuntu-24.04-arm | ||
| - ubuntu-latest | ||
| - windows-latest | ||
| steps: | ||
| - name: Download the sdist | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: cibw-sdist | ||
|
|
||
| - name: Get sdist filename | ||
| id: get-sdist | ||
| run: | | ||
| echo "sdist_filename=$(ls codecov-cli/dist/)" >> "${GITHUB_OUTPUT}" | ||
| shell: bash | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/[email protected] | ||
| with: | ||
| package-dir: codecov-cli/dist/${{ steps.get-sdist.outputs.sdist_filename }} | ||
|
|
||
| - name: Store the distribution packages | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-wheels-${{ matrix.os }} | ||
| path: ./wheelhouse/*.whl |
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
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,44 @@ | ||
| name: Create CLI Release | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| types: [closed] | ||
|
|
||
| jobs: | ||
| create-release: | ||
| if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'getsentry' }} | ||
| name: Create Github Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| fetch-tags: true | ||
|
|
||
| - id: get-release-vars | ||
| name: Configure Release Vars | ||
| run: | | ||
| release_version=v$(grep -E "version = \"[0-9]+\.[0-9]+\.[0-9]+\"" pyproject.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") | ||
| previous_version=$(git tag --sort=-creatordate | head -n 2 | tail -n 1) | ||
| echo "release_version=$release_version" | ||
| echo "previous_version=$previous_version" | ||
|
|
||
| echo "release_version=$release_version" >> "$GITHUB_OUTPUT" | ||
| echo "previous_version=$previous_version" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Get auth token | ||
| id: token | ||
| uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 | ||
| with: | ||
| app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} | ||
| private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} | ||
|
|
||
| # todo: potentially switch to https://github.com/getsentry/action-prepare-release once set up with craft | ||
| - name: Create GitHub Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.token.outputs.token }} | ||
| run: | | ||
| gh release create ${{ steps.get-release-vars.outputs.release_version }} --title "Release ${{ steps.get-release-vars.outputs.release_version }}" --notes "Autogenerated for ${{ steps.get-release-vars.outputs.release_version }}. Created for ${{ github.event.pull_request.html_url }}" --generate-notes --notes-start-tag ${{steps.get-release-vars.outputs.previous_version}} --target ${{ github.event.pull_request.head.sha }} |
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.
FYI some of this file might be able to be axed due to codecov/codecov-cli#664
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.
good shout tyty