chore(deps): bump pypa/cibuildwheel from 2.19.2 to 2.20.0 (#57) #184
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
name: Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint-python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # caching pip dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install -e .[all,test] | |
- name: Run isort check | |
run: python -m isort codebleu --check | |
- name: Run black check | |
run: python -m black codebleu --check | |
- name: Run ruff check | |
run: python -m ruff check codebleu | |
- name: Run mypy check | |
run: python -m mypy codebleu | |
# First run tests to fail fast, then testing on all python versions and os | |
fast-tests-python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # caching pip dependencies | |
- name: Install lib from source and dependencies | |
run: | | |
python -m pip install -e .[all,test] | |
- name: Run tests | |
run: python -m pytest | |
full-tests-python: | |
needs: [fast-tests-python] | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest, macos-latest, macos-13, windows-latest] # at the moment macos-latest=macos-14 is exclusive M1 chip, macos-13 is intel | |
fail-fast: false | |
name: Test wheel on ${{ matrix.os }} and Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheel (macos for "error externally-managed-environment") | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
python3 -m pip install --upgrade build wheel setuptools | |
python3 -m build --wheel --sdist --outdir ./dist --no-isolation | |
- name: Build wheel (all other) | |
if: "!startsWith(matrix.os, 'macos')" | |
run: | | |
python3 -m pip install --upgrade build | |
python3 -m build --wheel --sdist --outdir ./dist | |
- name: Show dist files | |
run: ls -lah ./dist | |
shell: bash | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' # caching pip dependencies | |
- name: Remove sdist package to force install wheel later | |
run: | | |
rm -rf ./dist/*.tar.gz | |
shell: bash | |
- name: Build tree-sitter languages for arm64 (not available on PyPI for now) | |
if: startsWith(matrix.os, 'macos-latest') | |
shell: bash | |
run: | | |
languages="python java javascript c-sharp c cpp go ruby rust php" | |
for lang in $languages; do | |
python3 -m pip install git+https://github.com/tree-sitter/tree-sitter-$lang | |
done | |
- name: Install lib and dependencies | |
run: | | |
# force install package from local dist directory | |
pip uninstall -y codebleu || true | |
# TODO: check the sdist package is not installed | |
pip install --upgrade --no-deps --no-index --find-links=./dist codebleu | |
# install dependencies for the package languages and tests | |
pip install .[all,test] | |
- name: Test itself | |
run: python -m pytest --cov-report=xml | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
files: coverage.xml | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
token: ${{ secrets.CODECOV_TOKEN }} # required |