Skip to content

Commit 518d31f

Browse files
revert: restore original codecov-cli release process
The release process inherited from getsentry/prevent-cli (Craft + build.yml + create-release.yml + release-codecov-cli.yml) is broken. Roll back to the original codecov-cli release flow, adapted for the current monorepo layout where the package lives under codecov-cli/. Removed: - .craft.yml - .github/workflows/build.yml (Craft-driven build of both CLIs) - .github/workflows/create-release.yml (getsentry/action-prepare-release) - .github/workflows/release-codecov-cli.yml (PyPI publish triggered by Craft release) - scripts/{bump-version.sh,build_alpine.sh,build_linux.sh,pre-build.sh,uv-installer-0.7.8.sha256sum} Restored (adapted to codecov-cli/ subdirectory + uv): - .github/workflows/create_release_pr.yml: workflow_dispatch bumps codecov-cli/pyproject.toml on a release/<version> branch and opens a PR into main. - .github/workflows/create_release.yml: on merge of a release/* PR, cuts the v<version> GitHub release. - .github/workflows/release_flow.yml: on release creation, calls build_for_pypi + build_assets, publishes to PyPI, and announces the release via the GCS pub/sub topic. - .github/workflows/build_for_pypi.yml: uv build of the codecov-cli sdist + wheel. - .github/workflows/build_assets.yml: pyinstaller binaries for macOS / Ubuntu / Windows + alpine and linux arm via Docker. - scripts/build_alpine_arm.sh and scripts/build_linux_arm.sh: Docker entrypoints that build the codecovcli_<distro>_<arch> binary out of codecov-cli/. prevent-cli sources are left in place but are no longer part of the release pipeline.
1 parent dbf2b74 commit 518d31f

11 files changed

Lines changed: 312 additions & 257 deletions

.craft.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 0 additions & 140 deletions
This file was deleted.

.github/workflows/build_assets.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Build Compiled Assets
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
release:
7+
type: boolean
8+
default: false
9+
description: "Attach artifacts to a release"
10+
11+
jobs:
12+
build_assets:
13+
name: Build packages - ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
include:
19+
- os: macos-latest
20+
TARGET: macos
21+
CMD_BUILD: >
22+
uv run pyinstaller --target-arch universal2 -F codecov_cli/main.py &&
23+
mv dist/main dist/codecovcli_macos &&
24+
lipo -archs dist/codecovcli_macos | grep 'x86_64 arm64'
25+
OUT_FILE_NAME: codecovcli_macos
26+
ASSET_MIME: application/octet-stream
27+
- os: ubuntu-22.04
28+
TARGET: ubuntu
29+
CMD_BUILD: >
30+
uv run pyinstaller -F codecov_cli/main.py &&
31+
cp ./dist/main ./dist/codecovcli_linux
32+
OUT_FILE_NAME: codecovcli_linux
33+
ASSET_MIME: application/octet-stream
34+
- os: windows-latest
35+
TARGET: windows
36+
CMD_BUILD: >
37+
uv run pyinstaller -F .\codecov_cli\main.py &&
38+
Copy-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe"
39+
OUT_FILE_NAME: codecovcli_windows.exe
40+
ASSET_MIME: application/vnd.microsoft.portable-executable
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Set up Python 3.11
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: "3.11"
48+
49+
- name: Install uv and dependencies
50+
run: |
51+
pip install uv
52+
# Need to build pyyaml and ijson from sdists to get universal2 macos build to work
53+
uv sync --no-binary-package pyyaml --no-binary-package ijson
54+
55+
- name: Build with pyinstaller for ${{matrix.TARGET}}
56+
run: ${{matrix.CMD_BUILD}}
57+
58+
- name: Upload a Build Artifact
59+
uses: actions/upload-artifact@v4
60+
if: inputs.release == false
61+
with:
62+
name: ${{ matrix.OUT_FILE_NAME }}
63+
path: ./dist/${{ matrix.OUT_FILE_NAME }}
64+
65+
- name: Upload Release Asset
66+
if: inputs.release == true
67+
id: upload-release-asset
68+
uses: svenstaro/upload-release-action@v2
69+
with:
70+
repo_token: ${{ secrets.GITHUB_TOKEN }}
71+
file: ./dist/${{ matrix.OUT_FILE_NAME }}
72+
asset_name: ${{ matrix.OUT_FILE_NAME }}
73+
tag: ${{ github.ref }}
74+
overwrite: true
75+
76+
build_assets_alpine_arm:
77+
name: Build assets - Alpine and ARM
78+
runs-on: ${{ matrix.runs-on }}
79+
strategy:
80+
matrix:
81+
include:
82+
- distro: "alpine:3.14"
83+
arch: arm64
84+
distro_name: alpine
85+
runs-on: ubuntu-24.04-arm
86+
- distro: "alpine:3.14"
87+
arch: x86_64
88+
distro_name: alpine
89+
runs-on: ubuntu-24.04
90+
- distro: "ubuntu:20.04"
91+
arch: arm64
92+
distro_name: linux
93+
runs-on: ubuntu-24.04-arm
94+
95+
steps:
96+
- uses: actions/checkout@v4
97+
98+
- name: Run in Docker
99+
run: |
100+
docker run \
101+
--rm \
102+
-v $(pwd):/${{ github.workspace }} \
103+
-w ${{ github.workspace }} \
104+
--platform linux/${{ matrix.arch }} \
105+
${{ matrix.distro }} \
106+
./scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }}
107+
108+
- name: Upload a Build Artifact
109+
uses: actions/upload-artifact@v4
110+
if: inputs.release == false
111+
with:
112+
name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
113+
path: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
114+
115+
- name: Upload Release Asset
116+
if: inputs.release == true
117+
id: upload-release-asset
118+
uses: svenstaro/upload-release-action@v2
119+
with:
120+
repo_token: ${{ secrets.GITHUB_TOKEN }}
121+
file: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
122+
asset_name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
123+
tag: ${{ github.ref }}
124+
overwrite: true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Build for PyPi
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
publish:
8+
type: boolean
9+
default: false
10+
description: "Build for PyPi"
11+
12+
jobs:
13+
build_for_pypi:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: Install uv
21+
run: pip install uv
22+
23+
- name: Build sdist and wheel
24+
run: uv build
25+
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: cibw-codecov-cli
30+
path: ./dist/*

.github/workflows/create-release.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Create CLI Release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [closed]
8+
9+
jobs:
10+
create-release:
11+
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'codecov' }}
12+
name: Create Github Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
fetch-tags: true
20+
21+
- id: get-release-vars
22+
name: Configure Release Vars
23+
run: |
24+
release_version=v$(grep -E "version = \"[0-9]+\.[0-9]+\.[0-9]+\"" pyproject.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")
25+
previous_version=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
26+
echo "release_version=$release_version"
27+
echo "previous_version=$previous_version"
28+
29+
echo "release_version=$release_version" >> "$GITHUB_OUTPUT"
30+
echo "previous_version=$previous_version" >> "$GITHUB_OUTPUT"
31+
32+
- name: Create GitHub Release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.CODECOV_RELEASE_PAT }}
35+
run: |
36+
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 }}

0 commit comments

Comments
 (0)