rules_pytest v0.0.1 #4
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
env: | |
BAZEL_STARTUP_FLAGS: --bazelrc=${{ github.workspace }}/.github/github.bazelrc | |
jobs: | |
# ci: | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# matrix: | |
# include: | |
# - os: macos-11 | |
# - os: ubuntu-20.04 | |
# - os: windows-2019 | |
# steps: | |
# # Checkout the code | |
# - uses: actions/checkout@v2 | |
# # Caches and restores the Bazel outputs. | |
# - name: Retain Bazel cache (linux) | |
# uses: actions/cache@v2 | |
# env: | |
# cache-name: bazel-cache | |
# with: | |
# path: | | |
# ~/.cache/bazelisk | |
# ~/.cache/bazel | |
# key: ${{ runner.os }}-${{ env.cache-name }} | |
# if: startswith(runner.os, 'Linux') | |
# - name: Retain Bazel cache (MacOS) | |
# uses: actions/cache@v2 | |
# env: | |
# cache-name: bazel-cache | |
# with: | |
# path: | | |
# ~/.cache/bazelisk | |
# /private/var/tmp/_bazel_runner | |
# key: ${{ runner.os }}-${{ env.cache-name }} | |
# if: startswith(runner.os, 'MacOS') | |
# - name: Retain Bazel cache (Windows) | |
# uses: actions/cache@v2 | |
# env: | |
# cache-name: bazel-cache | |
# with: | |
# path: | | |
# ~/.cache/bazelisk | |
# C:/bzl | |
# key: ${{ runner.os }}-${{ env.cache-name }} | |
# if: startswith(runner.os, 'Windows') | |
# - name: Setup Bazelrc (Windows) | |
# run: | | |
# echo "startup --output_user_root=C:/bzl" > ./user.bazelrc | |
# if: startswith(runner.os, 'Windows') | |
# - name: Setup Bazelrc | |
# run: | | |
# echo "common --noenable_bzlmod" >> ./user.bazelrc | |
# echo "common --keep_going" >> ./user.bazelrc | |
# # Build and Test the code | |
# - name: Test (Unix) | |
# run: bazel ${BAZEL_STARTUP_FLAGS[@]} test //... | |
# if: startswith(runner.os, 'Windows') != true | |
# - name: Test (Windows) | |
# run: bazel $env:BAZEL_STARTUP_FLAGS test //... | |
# if: startswith(runner.os, 'Windows') | |
ci-buildifier: | |
runs-on: ubuntu-20.04 | |
steps: | |
# Checkout the code | |
- uses: actions/checkout@v2 | |
- name: Download Buildifier | |
run: | | |
wget "https://github.com/bazelbuild/buildtools/releases/download/v7.1.2/buildifier-linux-amd64" -O buildifier | |
chmod +x buildifier | |
- name: Buildifier | |
run: ./buildifier -lint=warn -mode=check -warnings=all -r ${{ github.workspace }} | |
ci-lint-and-format: | |
runs-on: ubuntu-20.04 | |
steps: | |
# Checkout the code | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Setup pip | |
run: | | |
python -m pip install --upgrade pip setuptools | |
- name: Install dependencies | |
run: | | |
pip install -r python/pytest/requirements.linux.txt --user | |
- name: Run mypy | |
run: | | |
python -m mypy python | |
- name: Run pylint | |
run: | | |
PYTHONPATH="$(pwd)" python -m pylint python | |
- name: Run black | |
run: | | |
python -m black --check --diff python | |
- name: Run isort | |
run: | | |
python -m isort --check-only python | |