Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
github:
owner: getsentry
repo: prevent-cli
owner: codecov
repo: codecov-cli

changelogPolicy: auto

targets:
# For direct binary downloads + cosign bundles
- name: github
tagPrefix: v
checksums:
- algorithm: sha256
includeNames: /^(sentry-prevent-|sentry_prevent_|codecov|codecov_)cli.*/i
includeNames: /^(codecov|codecov_)cli.*/i

- name: pypi
includeNames: /sentry_prevent_cli-*/i
includeNames: /codecov_cli-*/i
2 changes: 1 addition & 1 deletion .github/workflows/broadcast_api_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Broadcast API changes
on:
push:
branches: ['main']
paths: ['codecov-cli/codecovcli_commands', 'prevent-cli/preventcli_commands']
paths: ['codecovcli_commands']

jobs:
run:
Expand Down
75 changes: 9 additions & 66 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This workflow builds both sentry-prevent-cli and codecov-cli on push to a
# release/* branch. These are later released by Craft and another workflow,
# respectively.
# This workflow builds codecov-cli on push to a release/* branch. The artifacts
# are later picked up and released by Craft.
name: Build release

on:
Expand All @@ -25,26 +24,13 @@ jobs:
run: pip install uv

- name: Build codecov-cli sdist and bdist
run: |
cd codecov-cli
uv build

- name: Build prevent-cli sdist and bdist
run: |
cd prevent-cli
uv build
run: uv build

- name: Upload codecov-cli artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: codecov-cli_wheel
path: ./codecov-cli/dist/*

- name: Upload prevent-cli artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: sentry-prevent-cli_wheel
path: ./prevent-cli/dist/*
path: ./dist/*

build_assets:
name: Build ${{ matrix.os }} binaries
Expand All @@ -56,24 +42,16 @@ jobs:
- os: macos-14
TARGET: macos
CMD_BUILD: >
cd ./codecov-cli &&
uv run pyinstaller --target-arch universal2 -F ./codecov_cli/main.py &&
mv ./dist/main ./dist/codecovcli_macos &&
cd ../prevent-cli &&
uv run pyinstaller --target-arch universal2 -F ./src/prevent_cli/main.py &&
mv ./dist/main ./dist/sentry-prevent-cli_macos
mv ./dist/main ./dist/codecovcli_macos
OUT_FILE_SUFFIX: _macos
ASSET_MIME: application/octet-stream

- os: windows-2022
TARGET: windows
CMD_BUILD: >
Set-Location .\codecov-cli &&
uv run pyinstaller -F .\codecov_cli\main.py &&
Move-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe" &&
Set-Location ..\prevent-cli &&
uv run pyinstaller -F .\src\prevent_cli\main.py &&
Move-Item -Path ".\dist\main.exe" -Destination ".\dist\sentry-prevent-cli_windows.exe"
Move-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe"
OUT_FILE_SUFFIX: _windows.exe
ASSET_MIME: application/vnd.microsoft.portable-executable

Expand All @@ -88,14 +66,8 @@ jobs:
- name: Install dependencies
run: |
pip install uv
cd prevent-cli
# Need to build pyyaml and ijson from sdists to get universal2 macos build to work
uv sync --no-binary-package pyyaml --no-binary-package ijson
cd ../codecov-cli
uv sync --no-binary-package pyyaml --no-binary-package ijson

- name: Run pre-build script
run: ./scripts/pre-build.sh

- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
Expand All @@ -104,13 +76,7 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: codecovcli${{matrix.OUT_FILE_SUFFIX}}
path: ./codecov-cli/dist/codecovcli${{matrix.OUT_FILE_SUFFIX}}

- name: Upload sentry-prevent-cli binary for ${{matrix.TARGET}}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: sentry-prevent-cli${{matrix.OUT_FILE_SUFFIX}}
path: ./prevent-cli/dist/sentry-prevent-cli${{matrix.OUT_FILE_SUFFIX}}
path: ./dist/codecovcli${{matrix.OUT_FILE_SUFFIX}}

build_linux_assets:
name: Build ${{ matrix.distro_name }}_${{ matrix.arch }} binary
Expand Down Expand Up @@ -152,46 +118,23 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
path: ./codecov-cli/dist/codecovcli_*

- name: Upload sentry-prevent-cli binary for ${{matrix.distro_name}}_${{ matrix.arch}}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: sentry-prevent-cli_${{ matrix.distro_name }}_${{ matrix.arch }}
path: ./prevent-cli/dist/sentry-prevent-cli_*
path: ./dist/codecovcli_*

package_artifacts:
# Craft requires one artifact named after the long commit sha of the release.
name: Package assets for Craft
runs-on: ubuntu-latest
needs: [build_for_pypi, build_assets, build_linux_assets]
permissions:
id-token: write # needed for signing binaries with OIDC token via Cosign
steps:
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: "{sentry-prevent-,codecov-,codecov}cli*"

- name: Install Cosign
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2

- name: Sign sentry-prevent-cli binaries
run: |
# Glob matches all prevent-cli binaries, not python wheel nor anything else.
for file in sentry-prevent-cli_*/sentry-prevent-cli_*; do
cosign sign-blob $file --bundle "$file.bundle" --yes;
# Test verification because why not
cosign verify-blob $file --bundle "$file.bundle" --certificate-identity-regexp="^https://github\.com/getsentry/prevent-cli/\.github/workflows/build\.yml@refs/heads/release/[0-9]+\.[0-9]+\.[0-9]+" --certificate-oidc-issuer=https://token.actions.githubusercontent.com
done
pattern: "{codecov-,codecov}cli*"

- name: Upload release artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ github.sha }}
path: |
sentry-prevent-cli*
sentry-prevent-cli_wheel/*
codecovcli*
codecov-cli_wheel/*
*.bundle
31 changes: 11 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ jobs:
- name: Install dependencies
run: |
python -m pip install uv
uv sync --project prevent-cli
uv sync

- name: Run command_dump
run: |
make command_dump

- name: Detect changes on commit
run: |
if [ -n "$(git diff codecov-cli/codecovcli_commands prevent-cli/preventcli_commands)" ]; then
if [ -n "$(git diff codecovcli_commands)" ]; then
echo "Please run `make command_dump` before submitting, or install the hooks"
echo "$(git diff codecov-cli/codecovcli_commands prevent-cli/preventcli_commands)"
echo "$(git diff codecovcli_commands)"
exit 1
fi

codecov-startup:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }}
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -66,15 +66,15 @@ jobs:
- name: Install CLI
run: |
pip install uv
uv sync --project codecov-cli
uv sync

- name: Create commit in codecov
run: |
uv run --project codecov-cli codecovcli -v create-commit -t ${{ secrets.CODECOV_TOKEN }} --git-service github
uv run codecovcli -v create-commit -t ${{ secrets.CODECOV_TOKEN }} --git-service github

- name: Create commit report in codecov
run: |
uv run --project codecov-cli codecovcli -v create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github
uv run codecovcli -v create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github

build-test-upload:
strategy:
Expand All @@ -96,25 +96,16 @@ jobs:
- name: Install dependencies
run: |
pip install uv
uv sync --project codecov-cli
uv sync --project prevent-cli
uv sync

- name: Test with pytest
run: |
cd codecov-cli
uv run pytest --cov --junitxml=${{matrix.os}}-${{matrix.python-version}}junit.xml
env:
CODECOV_ENV: test

- name: Dogfooding codecov-cli
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }}
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
uv run --project codecov-cli codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli
uv run --project codecov-cli codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli

- name: Dogfooding sentry-prevent-cli
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }}
run: |
uv run --project prevent-cli sentry-prevent-cli upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag sentry-prevent-cli
uv run --project prevent-cli sentry-prevent-cli upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag sentry-prevent-cli
uv run --project prevent-cli sentry-prevent-cli upload --report-type test-results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag sentry-prevent-cli
uv run codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli
uv run codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli
4 changes: 2 additions & 2 deletions .github/workflows/release-codecov-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
with:
tag: ${{ github.ref_name }}
fileName: codecov_cli-*
out-file-path: codecov-cli/dist
out-file-path: dist

- name: Publish package to PyPi
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
verbose: true
packages-dir: codecov-cli/dist
packages-dir: dist

publish_release:
name: Publish release
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ lint:
make lint.run

test:
cd codecov-cli && uv run pytest
uv run pytest

command_dump:
cd prevent-cli && uv run command_dump.py
uv run python command_dump.py

tag.release:
ifeq ($(shell echo ${version} | egrep "${tag_regex}"),)
Expand Down
Loading
Loading