Skip to content

Commit 7883b41

Browse files
committed
Run linting in devcontainer
1 parent a1d1c73 commit 7883b41

File tree

2 files changed

+41
-13
lines changed

2 files changed

+41
-13
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: devcontainer command
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
run_cmd:
7+
required: true
8+
type: string
9+
description: 'Command to run in the dev container'
10+
11+
jobs:
12+
devcontainer-command:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Login to GitHub Container Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.repository_owner }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Run command in devcontainer
29+
uses: devcontainers/[email protected]
30+
with:
31+
imageName: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-devcontainer
32+
cacheFrom: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-devcontainer
33+
push: always
34+
runCmd: ${{ inputs.run_cmd }}

.github/workflows/lint.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
name: lint
22

3-
on:
4-
push:
5-
branches: [ "main" ]
3+
on: # rebuild any PRs and main branch changes
64
pull_request:
7-
branches: [ "main" ]
5+
push:
6+
branches:
7+
- main
88

99
jobs:
1010
lint:
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- uses: actions/checkout@v4
15-
16-
- name: Check formatting
17-
run: |
18-
find examples include tests -name '*.cpp' -o -name '*.h' |
19-
xargs clang-format -style=file -i # --dry-run --Werror
11+
uses: ./.github/workflows/devcontainer-command.yml
12+
with:
13+
run_cmd: pre-commit run --all-files --show-diff-on-failure

0 commit comments

Comments
 (0)