Skip to content

feat: update CI workflows #10

feat: update CI workflows

feat: update CI workflows #10

Workflow file for this run

---
# yamllint disable rule:line-length
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CLI CI
on:
pull_request:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Check linting with ruff
run: |
make lint
detect-command-change:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
cd codecov-cli
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install -e .
- name: Run command_dump
run: |
cd codecov-cli
python command_dump.py
- name: Detect changes on commit
run: |
if [ -n "$(git diff codecovcli_commands)" ]; then
echo "Please run `python command_dump.py` before submitting, or install the hooks"
echo "$(git diff codecovcli_commands)"
exit 1
fi
# todo: dump commands for prevent-cli. Maybe compare prevent and cc?
codecov-startup:
runs-on: ubuntu-latest
#if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install CLI
# todo: update this to dogfood prevent cli, maybe try both?
run: |
pip install codecov-cli
- name: Create commit in codecov
run: |
codecovcli create-commit -t ${{ secrets.CODECOV_TOKEN }} --git-service github
- name: Create commit report in codecov
run: |
codecovcli create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github
build-test-upload:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- name: Set up Python ${{matrix.python-version}}
uses: actions/setup-python@v5
with:
python-version: "${{matrix.python-version}}"
- name: Install dependencies
run: |
cd codecov-cli
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install -e .
pip install -r tests/requirements.txt
- name: Test with pytest
run: |
cd codecov-cli
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' }}
run: |
codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}}
codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}}
# todo: dogfood prevent-cli
# todo: I don't think we need this?
# - name: Upload artifacts for test-results-processing
# if: ${{ !cancelled() }}
# uses: actions/upload-artifact@v4
# with:
# name: ${{matrix.os}}-${{matrix.python-version}}junit.xml
# path: ${{matrix.os}}-${{matrix.python-version}}junit.xml
# todo: I don't think we need this either? we're uploading TA three times?
# process-test-results:
# if: ${{ always() }}
# needs: build-test-upload
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# fetch-depth: 2
# - uses: actions/setup-python@v5
# with:
# python-version: "3.12"
# - name: Install dependencies for Dogfooding
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# python -m pip install -e .
# pip install -r tests/requirements.txt
# - name: Download all test results
# uses: actions/download-artifact@v4
# with:
# pattern: "*junit.xml"
# path: "test_results"
# merge-multiple: true
#
# - name: Dogfooding codecov-cli
# if: ${{ !cancelled() && github.ref && contains(github.ref, 'pull') }}
# run: |
# codecovcli process-test-results --dir test_results --github-token ${{ secrets.GITHUB_TOKEN }}