Split robot code to correct folder #73
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
name: CI | |
on: | |
push: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
# Cancel previous actions from the same PR: https://stackoverflow.com/a/72408109 | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout | |
uses: actions/checkout@v4 | |
- name: πΏ Setup Bazel | |
uses: bazel-contrib/[email protected] | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
bazelrc: | | |
build --color=yes | |
build --show_timestamps | |
- name: ποΈ Track Current Files | |
run: touch /tmp/pre_fmt | |
- name: π§Ή Format Repository | |
run: bazel run //:format | |
- name: π Detect Diff | |
run: | | |
set +x | |
formatted_files=$(find ./config ./src ./tools -newer /tmp/pre_fmt) | |
num_formatted_files=$(find ./config ./src ./tools -newer /tmp/pre_fmt | wc -l) | |
if [ "$num_formatted_files" -gt "0" ]; then | |
echo "βπ₯ Bad code detected! The following files would be reformatted:" | |
echo "$formatted_files" | |
exit 1 | |
fi | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout | |
uses: actions/checkout@v4 | |
- name: πΏ Setup Bazel | |
uses: bazel-contrib/[email protected] | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
bazelrc: | | |
build --color=yes | |
build --show_timestamps | |
- name: π§ͺ Run Tests | |
run: bazel test //src/... |