Add bzlmod support. #156
Workflow file for this run
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 will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
exclude: | |
# No Python 3.7 available on MacOS | |
- platform: macos-latest | |
python_version: 3.7 | |
runs-on: ${{ matrix.platform }} | |
name: test ${{ matrix.platform }} (py${{ matrix.python_version }}) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "${{ matrix.python_version }}" | |
- name: Setup pip | |
run: | | |
python -m pip install --upgrade pip setuptools | |
- name: Install dependencies (py37) | |
run: | | |
pip install -r 3rdparty/requirements.37.txt --user | |
if: ${{ matrix.python_version == '3.7' }} | |
- name: Install dependencies | |
run: | | |
pip install -r 3rdparty/requirements.311.txt --user | |
if: ${{ matrix.python_version != '3.7' }} | |
- name: Run mypy | |
run: | | |
python -m mypy req_compile | |
env: | |
MYPYPATH: req-compile/stubs | |
- name: Run pylint | |
run: | | |
python -m pylint req_compile tests | |
- name: Test with pytest | |
run: | | |
python -m pytest -v --ignore=private | |
formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r 3rdparty/requirements.311.txt --user | |
- name: Run black | |
run: | | |
black --check --diff req_compile | |
- name: Run isort | |
run: | | |
isort --check-only req_compile | |
bazel-workspace: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["ubuntu-latest", "macos-14", "windows-latest"] | |
runs-on: ${{ matrix.platform }} | |
name: bazel test --build ${{ matrix.platform }} (WORKSPACE.bazel) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure Build Event Service | |
run: | | |
echo "common --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}" > "${CI_BAZELRC_PATH}" | |
echo "common --config=bes" >> "${CI_BAZELRC_PATH}" | |
echo "common --announce_rc" >> "${CI_BAZELRC_PATH}" | |
env: | |
CI_BAZELRC_PATH: .github/ci.bazelrc | |
- name: Run Tests | |
run: | | |
bazel test --noenable_bzlmod //... | |
- name: Perform compilation | |
run: | | |
bazel run --noenable_bzlmod //3rdparty:requirements_compiler "--" --upgrade | |
bazel-bzlmod: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["ubuntu-latest", "macos-14", "windows-latest"] | |
runs-on: ${{ matrix.platform }} | |
name: bazel test --build ${{ matrix.platform }} (bzlmod) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure Build Event Service | |
run: | | |
echo "common --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}" > "${CI_BAZELRC_PATH}" | |
echo "common --config=bes" >> "${CI_BAZELRC_PATH}" | |
echo "common --announce_rc" >> "${CI_BAZELRC_PATH}" | |
env: | |
CI_BAZELRC_PATH: .github/ci.bazelrc | |
- name: Run Tests | |
run: | | |
bazel test //... | |
- name: Perform compilation | |
run: | | |
bazel run //3rdparty:requirements_compiler "--" --upgrade | |
bazel_users: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["ubuntu-latest", "macos-14", "windows-latest"] | |
runs-on: ${{ matrix.platform }} | |
name: bazel test multiplatform_py_test --build ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Test user repo examples | |
run: | | |
bazel test //... | |
working-directory: private/examples/multiplatform_py_test | |
- name: Test user repo examples (WORKSPACE.bazel) | |
run: | | |
bazel test //... --noenable_bzlmod | |
working-directory: private/examples/multiplatform_py_test | |
bazel_lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r 3rdparty/requirements.311.txt --user | |
pip install -e . | |
- name: Run isort | |
run: | | |
isort --check-only private | |
- name: Run black | |
run: | | |
black --check --diff private | |
- name: Run pylint | |
run: | | |
python -m pylint private | |
- name: Run buildifier | |
run: bazel run //:buildifier.check |