Skip to content

Refine partial merge logic #1087

Refine partial merge logic

Refine partial merge logic #1087

Workflow file for this run

name: unit tests
on:
push: # run on every push or PR to any branch
pull_request:
env:
# python version used to calculate and submit code coverage
COV_PYTHON_VERSION: "3.12"
jobs:
python-unit:
name: Python unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.12", "3.13"]
defaults:
run:
working-directory: .
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
enable-cache: true
- name: Install dependencies
run: uv sync --extra test
- name: Run pytest
run: uv run pytest --cov=corppa --cov=test --cov-report=xml
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
# Set the color of the slack message used in the next step based on the
# status of the build: "danger" for failure, "good" for success,
# "warning" for error
- name: Set Slack message color based on build status
if: ${{ always() }}
env:
JOB_STATUS: ${{ job.status }}
run: echo "SLACK_COLOR=$(if [ "$JOB_STATUS" == "success" ]; then echo "good"; elif [ "$JOB_STATUS" == "failure" ]; then echo "danger"; else echo "warning"; fi)" >> $GITHUB_ENV
# Send a message to slack to report the build status. The webhook is stored
# at the organization level and available to all repositories. Only run on
# scheduled builds & pushes, since PRs automatically report to Slack.
- name: Report status to Slack
uses: rtCamp/action-slack-notify@master
if: ${{ always() && (github.event_name == 'schedule' || github.event_name == 'push') }}
continue-on-error: true
env:
SLACK_COLOR: ${{ env.SLACK_COLOR }}
SLACK_WEBHOOK: ${{ secrets.ACTIONS_SLACK_WEBHOOK }}
SLACK_TITLE: "Workflow `${{ github.workflow }}` (python ${{ matrix.python }}): ${{ job.status }}"
SLACK_MESSAGE: "Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|#${{ github.run_number }}> on <https://github.com/${{ github.repository }}/|${{ github.repository }}@${{ github.ref }}>"
SLACK_FOOTER: "<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|View commit>"
MSG_MINIMAL: true # use compact slack message format