Skip to content

Commit

Permalink
[CI][GitHub] Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
akmaru committed Jun 24, 2024
1 parent adc96b1 commit 1501985
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,10 @@ on:

env:
BUILD_TYPE: Release
BUILD_PATH: ${{ github.workspace}}/build
BUILD_PATH: build
BASE_TAG: ci-${{ github.run_id }}

jobs:
check-format:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'benchmark'
- 'include'
- 'src'
- 'test'
steps:
- uses: actions/checkout@v3

- name: Run clang-format style check for C/C++ programs.
uses: jidicula/clang-format-action@v4.10.2
with:
clang-format-version: '15'
check-path: ${{ matrix.path }}

build-image:
runs-on: ubuntu-latest
outputs:
Expand All @@ -55,8 +36,10 @@ jobs:
run: docker compose build base

- name: Push Docker Image
run: docker compose push base
run: docker compose push base

# TODO: Separate the build job into separate jobs, build, test, benchmark and lint-check
# after resolved the issue https://github.com/actions/upload-artifact/issues/38.
build:
needs: build-image
runs-on: ubuntu-latest
Expand All @@ -65,23 +48,20 @@ jobs:
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}

steps:
- uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{env.BUILD_PATH}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja

- name: Build
run: |
ls ${{env.BUILD_PATH}}
cmake --build ${{env.BUILD_PATH}} --config ${{env.BUILD_TYPE}}
run: cmake --build ${{env.BUILD_PATH}} --config ${{env.BUILD_TYPE}}

- name: Test
run: ctest --test-dir ${{env.BUILD_PATH}} -C ${{env.BUILD_TYPE}}

- name: Linter
run: find . -type f -name "*.h" -not -path '${{env.BUILD_PATH}}/*' -or -name "*.cc" -not -path '${{env.BUILD_PATH}}/*' | xargs clang-tidy -p ${{env.BUILD_PATH}}

- name: Benchmark
run: ${{env.BUILD_PATH}}/bin/cpp-template_benchmark
run: ${{ env.BUILD_PATH }}/bin/cpp-template_benchmark

- name: Lint check
run: ./scripts/lint/check_all.sh ${{ env.BUILD_PATH }}

0 comments on commit 1501985

Please sign in to comment.