Skip to content

Commit

Permalink
Refactor CI, disable json formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
AndBondStyle committed Mar 4, 2024
1 parent ebb2a37 commit a3ab3eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
64 changes: 20 additions & 44 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@ name: Test

on:
pull_request:
branches: [ "master" ]
types: [ opened, reopened, ready_for_review, synchronize ]

branches: [master]
push:
branches: [ "master" ]
branches: [master]

workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
name: Check pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]

extract-image:
name: Extraction of configs
name: Extract image version
runs-on: ubuntu-latest
outputs:
image-url: ${{ steps.extractor.outputs.image_url }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/checkout@v3
- name: Extract image URL
id: extractor
run: |
Expand All @@ -28,41 +34,33 @@ jobs:
echo $IMAGE_URL
build-and-check:
name: Building, testing, linting
name: Build, test, lint
needs: extract-image
runs-on: self-hosted
concurrency:
group: build-and-check-${{ github.ref }}
cancel-in-progress: true
env:
CMAKE_ARGS: "-DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_TOOLS_ADDRESS_SANITIZER=1"

container:
image: ${{ needs.extract-image.outputs.image-url}}

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

- name: Build ROS2 packages
shell: bash
run: |
source $ROS_ROOT/setup.bash
cd $GITHUB_WORKSPACE/packages
colcon build --merge-install --cmake-args $CMAKE_ARGS
colcon build --merge-install --cmake-args \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLS_ADDRESS_SANITIZER=ON
source install/setup.bash
- name: Test ROS2 packages
continue-on-error: true
shell: bash
run: |
cd $GITHUB_WORKSPACE/packages
colcon test --ctest-args tests --merge-install \
--executor parallel --parallel-workers $(nproc) \
--return-code-on-test-failure
- name: Run Clang-Tidy
shell: bash
run: |
FILES=$(find . \( -name '*.h' -or -name '*.cpp' -or -name '*.cc' \) \
-not -path '*/build/*' -not -path '*/install/*' -not -path '*/log/*')
Expand All @@ -72,25 +70,3 @@ jobs:
echo $FILE
clang-tidy --fix -p=packages/build $FILE
done
code-style:
name: Formatting
# FIXME
runs-on: ubuntu-latest
# needs: extract-image
# runs-on: self-hosted
concurrency:
group: code-style-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]

# temporary solution until pre-commit is not installed in the container
# - name: Launching pre-commit
# shell: bash
# run: |
# pip3 install pre-commit
# pre-commit run --color=always --all-files
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: pretty-format-json
args: [--autofix, --no-sort-keys]

# YAML linter
- repo: https://github.com/adrienverge/yamllint.git
Expand All @@ -37,3 +35,4 @@ repos:
rev: v17.0.6
hooks:
- id: clang-format
types: [c, c++]

0 comments on commit a3ab3eb

Please sign in to comment.