Skip to content

Commit 0ebeabf

Browse files
authored
fix code-format clang-format cache (#6015)
1 parent 2e10c1f commit 0ebeabf

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

.github/workflows/code-format.yml

+14-23
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ permissions:
1010
contents: write
1111

1212
jobs:
13-
clang-format:
13+
code-format:
1414
runs-on: ubuntu-latest
1515
container: ubuntu:20.04
1616
steps:
17+
- name: astyle
18+
run: |
19+
export DEBIAN_FRONTEND=noninteractive
20+
apt-get update -y
21+
apt-get install -y astyle git
22+
23+
- uses: actions/checkout@v4
24+
1725
- name: cache-clang-format
1826
id: cache-clang-format
1927
uses: actions/cache@v4
@@ -39,37 +47,20 @@ jobs:
3947
rm -rf llvm-project-10.0.1
4048
rm llvm-project-10.0.1.tar.xz
4149
42-
code-format:
43-
needs: [clang-format]
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: actions/checkout@v4
47-
48-
- name: cache-clang-format
49-
id: cache-clang-format
50-
uses: actions/cache@v4
51-
with:
52-
path: clang-format-install
53-
key: clang-format-install-5
54-
55-
- name: astyle
56-
run: |
57-
sudo apt-get update
58-
sudo apt-get install -y astyle
59-
6050
- name: code-format
6151
run: |
62-
mkdir -p ~/bin
63-
mv $GITHUB_WORKSPACE/clang-format-install/clang-format ~/bin/clang-format
52+
mv $GITHUB_WORKSPACE/clang-format-install/clang-format /usr/local/bin/clang-format
6453
rm -rf $GITHUB_WORKSPACE/clang-format-install
65-
export PATH=~/bin:$PATH
6654
sh codeformat.sh
6755
56+
- name: configure-git-safe-directory
57+
run: git config --global --add safe.directory /__w/ncnn/ncnn
58+
6859
- uses: stefanzweifel/git-auto-commit-action@v5
6960
with:
7061
commit_message: apply code-format changes
7162

7263
- name: restore-clang-format-cache
7364
run: |
7465
mkdir $GITHUB_WORKSPACE/clang-format-install
75-
cp -r ~/bin/clang-format $GITHUB_WORKSPACE/clang-format-install
66+
cp -r /usr/local/bin/clang-format $GITHUB_WORKSPACE/clang-format-install

0 commit comments

Comments
 (0)