Skip to content

Commit

Permalink
ci: run llvm-cov action on docker image and improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
danctorres committed Dec 14, 2024
1 parent dfca3fb commit 384203d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/check_pr_description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ name: PR description
on: # yamllint disable-line rule:truthy
pull_request:
types: [opened, edited, synchronize]

jobs:
check-description:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check PR description for issue link
id: contains_issue
run: |
Expand All @@ -25,6 +28,7 @@ jobs:
else
echo "PR description contains a valid issue link."
fi
- name: Fail PR if no issue link found
if: failure()
run: |-
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Clang-Format
on: # yamllint disable-line rule:truthy
pull_request:
branches: ['*']

jobs:
clang-format:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: GitLint
on: # yamllint disable-line rule:truthy
pull_request:
branches: ['*']

jobs:
gitlint:
runs-on: ubuntu-latest
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/llvm_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ on: # yamllint disable-line rule:truthy
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
container:
image: dtors/base-cpp:latest

- name: Install LLVM
run: |
sudo apt update
sudo apt install -y llvm
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Coverage Script
run: bazel run //tools/coverage:llvm_cov -- -t //examples/cpp:test -s
run: bazelisk run //tools/coverage:llvm_cov -- -t //examples/cpp:test -s
18 changes: 9 additions & 9 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ on: # yamllint disable-line rule:truthy
jobs:
yamllint:
runs-on: ubuntu-latest
container:
image: dtors/base-cpp:latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure Git Safe Directory
run: |
git config --global --add safe.directory $(pwd)
- name: Find affected files
run: |
Expand All @@ -20,7 +27,6 @@ jobs:
cat affected_files.txt
- name: Find affected yaml files
id: bazel_targets
run: |
> affected_yaml_files.txt
Expand All @@ -33,14 +39,8 @@ jobs:
sort -u affected_yaml_files.txt -o affected_yaml_files.txt
echo "Affected yaml files:"
cat affected_yaml_files.txt
echo "yaml_files=$(cat affected_yaml_files.txt | tr '\n' ' ')" >> $GITHUB_ENV
- name: Install yamllint
if: env.yaml_files != ''
run: |
python -m pip install --upgrade pip
pip install yamllint
shell: bash

- name: Lint YAML files
if: env.yaml_files != ''
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/cl

RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100

RUN update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-18 100

RUN echo "alias bazel='bazelisk'" >> $HOME/.bashrc

RUN echo 'if [ -d "$HOME/bin" ] ; then\n PATH="$HOME/bin:$PATH"\nfi' >> $HOME/.bashrc && \
Expand Down
2 changes: 1 addition & 1 deletion tools/coverage/llvm_cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [[ -z "${BAZEL_TESTS}" ]]; then
fi

OUTPUT_DIR="${OUTPUT_DIR:-"$(mktemp -d)/cov_report"}"
BAZEL_OUTPUT=${BAZEL_OUTPUT:-"/home/${USER}/.cache/coverage"}
BAZEL_OUTPUT=${BAZEL_OUTPUT:-"${HOME}/.cache/coverage"}
SKIP_HTML_REPORT=${SKIP_HTML_REPORT:-false}
echo "INFO: Bazel cache: ${BAZEL_OUTPUT}"
echo "INFO: Tests target: ${BAZEL_TESTS}"
Expand Down

0 comments on commit 384203d

Please sign in to comment.