Updated rules_python to 0.32.1 (#9010) #16550
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: Pre-commit | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 * * * *' # Hourly | |
workflow_dispatch: | |
jobs: | |
get_date: | |
name: ":clock: Get Date" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=ymd::$(date +'%Y-%m-%d')" | |
outputs: | |
ymd: ${{ steps.date.outputs.ymd }} | |
format: | |
runs-on: ubuntu-latest | |
needs: | |
- get_date | |
steps: | |
- uses: actions/checkout@v3 | |
- name: google-java-format cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/google-java-format" | |
key: google-java-format-${{ hashFiles('tools/fix_java_format.sh') }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Java Formatting | |
run: tools/fix_java_format.sh --check | |
json_template: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: python -m pip install pytest | |
- name: JSON Templates | |
run: cd tests && pytest | |
checkstyle: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkstyle cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/checkstyle" | |
key: checkstyle-${{ hashFiles('tools/run_checkstyle.sh') }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Checkstyle | |
run: tools/run_checkstyle.sh | |
bazel_build_test_and_pmd: | |
needs: | |
- get_date | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bazelisk cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazelisk" | |
key: ${{runner.os}}-bazelisk-${{ hashFiles('.bazelversion') }} | |
- name: Bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: ${{runner.os}}-bazel-${{ hashFiles('.bazelversion', 'WORKSPACE', 'maven_install.json') }}-test-${{ needs.get_date.outputs.ymd }} | |
restore-keys: | | |
${{runner.os}}-bazel-${{ hashFiles('.bazelversion', 'WORKSPACE', 'maven_install.json') }}-test- | |
${{runner.os}}-bazel-${{ hashFiles('.bazelversion', 'WORKSPACE', 'maven_install.json') }}- | |
${{runner.os}}-bazel- | |
- name: Bazel build and test | |
run: | | |
bazel test --test_output=errors --test_tag_filters=-pmd_test --build_tag_filters=-pmd_test -- //... | |
bazel test --test_output=errors --test_tag_filters=pmd_test -- //... | |
- name: Build JAR | |
run: | | |
mkdir workspace | |
bazel build //projects/allinone:allinone_main_deploy.jar | |
cp bazel-bin/projects/allinone/allinone_main_deploy.jar workspace/allinone.jar | |
- name: Save JAR | |
uses: actions/upload-artifact@v3 | |
with: | |
name: allinone_jar | |
path: workspace/allinone.jar | |
code_cov: | |
needs: | |
- format | |
- json_template | |
- get_date | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bazelisk cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazelisk" | |
key: ${{runner.os}}-bazelisk-${{ hashFiles('.bazelversion') }} | |
- name: Bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: ${{runner.os}}-bazel-${{ hashFiles('.bazelversion', 'WORKSPACE', 'maven_install.json') }}-junit-${{ needs.get_date.outputs.ymd }} | |
restore-keys: | | |
${{runner.os}}-bazel-${{ hashFiles('.bazelversion', 'WORKSPACE', 'maven_install.json') }}-junit- | |
${{runner.os}}-bazel-${{ hashFiles('.bazelversion', 'WORKSPACE', 'maven_install.json') }}- | |
${{runner.os}}-bazel- | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Bazel Junit Tests and Coverage | |
run: | | |
bazel coverage //projects/... \ | |
--instrumentation_filter="-//projects/batfish/src/main/java/org/batfish/representation/juniper/parboiled,-//projects/batfish/src/main/java/org/batfish/vendor/check_point_management/parsing/parboiled,-//projects/batfish-common-protocol:specifier_common,-//projects/batfish/src/main/antlr4[/:],-//projects/.*/src/test[/:]" \ | |
--test_tag_filters=-pmd_test \ | |
--combined_report=lcov \ | |
--instrument_test_targets=false | |
- name: Generate report | |
uses: codecov/codecov-action@v3 | |
with: | |
files: bazel-out/_coverage/_coverage_report.dat | |
fail_ci_if_error: true | |
verbose: true |