Skip to content

Commit

Permalink
tweak workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlion committed Jun 4, 2024
1 parent df17baa commit d1e3e6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 39 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Lint"
name: "lint"

on:
push:
Expand All @@ -16,16 +16,13 @@ jobs:
os: ["ubuntu-latest", "macos-latest"]
runs-on: "${{ matrix.os }}"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: "actions/checkout@v4"

- name: "Setup Go"
uses: "actions/setup-go@v5"
- uses: "actions/setup-go@v5"
with:
go-version: "${{ matrix.go }}"

- name: "Lint go code"
uses: "golangci/golangci-lint-action@v6"
- uses: "golangci/golangci-lint-action@v6"
with:
version: "v1.59"

Expand All @@ -35,34 +32,29 @@ jobs:
os: ["ubuntu-latest", "macos-latest"]
runs-on: "${{ matrix.os }}"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: "actions/checkout@v4"
with:
submodules: "recursive"

- name: "Macos: install clang/llvm"
if: "${{ matrix.os == 'macos-latest' }}"
- if: "${{ matrix.os == 'macos-latest' }}"
run: |
brew update
brew install llvm@18
sudo ln -s /opt/homebrew/opt/llvm/bin/clang-format /usr/local/bin/clang-format-18
sudo ln -s /opt/homebrew/opt/llvm/bin/clang-tidy /usr/local/bin/clang-tidy-18
ln -s /opt/homebrew/opt/llvm/bin/clang-format /usr/local/bin/clang-format-18
ln -s /opt/homebrew/opt/llvm/bin/clang-tidy /usr/local/bin/clang-tidy-18
- name: "Linux: install clang/llvm"
if: "${{ matrix.os == 'ubuntu-latest' }}"
- if: "${{ matrix.os == 'ubuntu-latest' }}"
run: |
curl --proto '=https' --tlsv1.2 -sSf https://apt.llvm.org/llvm.sh | sudo bash -s -- 18
sudo apt install -y clang-format-18 clang-tidy-18
curl https://apt.llvm.org/llvm.sh | sudo bash -s -- 18
apt install -y clang-format-18 clang-tidy-18
- name: "Build for compile commands.json"
run: |
- name: "Build compile_commands.json for clang tools"
- run: |
cmake -S cpp/ -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1
ln -s build/compile_commands.json .
- name: "Clang format"
run: |
find cpp/src -type f | xargs clang-format-18 -i
- run: |
find cpp/src -type f | xargs clang-format-18 --Werror --dry-run
- name: "Clang tidy"
run: |
- run: |
find cpp/src -type f | xargs clang-tidy-18
23 changes: 8 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test"
name: "test"

on:
pull_request:
Expand All @@ -13,16 +13,13 @@ jobs:
os: ["ubuntu-latest", "macos-latest"]
runs-on: "${{ matrix.os }}"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: "actions/checkout@v4"

- name: "Setup Go"
uses: "actions/setup-go@v5"
- uses: "actions/setup-go@v5"
with:
go-version: "${{ matrix.go }}"

- name: "Unit tests"
run: |
- run: |
go clean -cache
go test -count=1 ./...
Expand All @@ -33,18 +30,15 @@ jobs:
os: ["ubuntu-latest", "macos-latest"]
runs-on: "${{ matrix.os }}"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: "actions/checkout@v4"
with:
submodules: "recursive"

- name: "Setup Go"
uses: "actions/setup-go@v5"
- uses: "actions/setup-go@v5"
with:
go-version: "${{ matrix.go }}"

- name: "Macos: install dependencies"
if: "${{ matrix.os == 'macos-latest' }}"
- if: "${{ matrix.os == 'macos-latest' }}"
run: |
brew update
brew install cmake gcc
Expand All @@ -58,7 +52,6 @@ jobs:
go install golang.org/x/tools/cmd/stringer@latest
go generate ./...
- name: "Unit tests"
run: |
- run: |
go clean -cache
go test -count=1 ./...

0 comments on commit d1e3e6f

Please sign in to comment.