Int: Initial foundation of E2E tests to simplify release process #2562
This file contains 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 workflow runs tests and reports code coverage. | |
# We need a workflow name to be able to schedule it from Github UI | |
name: TestCoverage | |
on: | |
# Triggers the workflow on push to main | |
push: | |
branches: | |
- main | |
# Triggers the workflow on any PR | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# The job ID has to match repo settings for PR required checks | |
TestCoverage: | |
runs-on: ${{ matrix.os }} | |
# Run jobs for a couple of Python versions and OSes. | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
# Choice of Python versions to run against: | |
# * 3.9: the oldest supported version | |
# * 3.11: the latest officially supported version. Used in CE images. | |
python: ["3.9", "3.11"] | |
# Extend the matrix with a job that prints coverage. | |
# Because { os: "ubuntu-latest", python: "3.11" } is already in the matrix, | |
# print_coverage: true is added to that job. | |
include: | |
- os: "ubuntu-latest" | |
python: "3.11" | |
print_coverage: true | |
timeout-minutes: 25 | |
name: Coverage - Python ${{ matrix.python }} - ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Fetch depth 0 required to compare against `main` | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: x64 | |
cache: 'pip' | |
# Installation method (venv/system/etc) affects Ray behavior. We're | |
# installing deps to a venv to align with the most common use case. | |
# Hence, we'll need to ensure the venv is always activated. More info: | |
# https://stackoverflow.com/questions/74668349/how-to-activate-a-virtualenv-in-a-github-action | |
- name: Install deps | |
shell: bash | |
run: | | |
python3 -m venv ./venv | |
source ./venv/bin/activate | |
make github_actions | |
- name: Run tests and gather coverage stats | |
shell: bash | |
run: | | |
source ./venv/bin/activate | |
make coverage | |
- name: Upload coverage reports as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
.coverage | |
coverage.xml | |
name: coverage-reports-python${{ matrix.python }} | |
- name: Comment with code coverage | |
# Conditionally run this step to prevent multiple comments | |
# Occasionally, multiple jobs could post at the same time. | |
if: matrix.print_coverage | |
uses: zapatacomputing/command-pr-comment@baca4fb9246eaaee3e47f35f296764acc394fae7 | |
with: | |
command: make PYTHON=./venv/bin/python github-actions-coverage-report | |
template: "🚀 Code Coverage\n```%command%```" | |
update-text: "🚀 Code Coverage" |