Browse Source

fix code-format clang-format cache (#6015)

tags/20250428
nihui GitHub 1 year ago
parent
commit
0ebeabfa90
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 23 deletions
  1. +14
    -23
      .github/workflows/code-format.yml

+ 14
- 23
.github/workflows/code-format.yml View File

@@ -10,10 +10,18 @@ permissions:
contents: write

jobs:
clang-format:
code-format:
runs-on: ubuntu-latest
container: ubuntu:20.04
steps:
- name: astyle
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
apt-get install -y astyle git

- uses: actions/checkout@v4

- name: cache-clang-format
id: cache-clang-format
uses: actions/cache@v4
@@ -39,32 +47,15 @@ jobs:
rm -rf llvm-project-10.0.1
rm llvm-project-10.0.1.tar.xz

code-format:
needs: [clang-format]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: cache-clang-format
id: cache-clang-format
uses: actions/cache@v4
with:
path: clang-format-install
key: clang-format-install-5

- name: astyle
run: |
sudo apt-get update
sudo apt-get install -y astyle

- name: code-format
run: |
mkdir -p ~/bin
mv $GITHUB_WORKSPACE/clang-format-install/clang-format ~/bin/clang-format
mv $GITHUB_WORKSPACE/clang-format-install/clang-format /usr/local/bin/clang-format
rm -rf $GITHUB_WORKSPACE/clang-format-install
export PATH=~/bin:$PATH
sh codeformat.sh

- name: configure-git-safe-directory
run: git config --global --add safe.directory /__w/ncnn/ncnn

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: apply code-format changes
@@ -72,4 +63,4 @@ jobs:
- name: restore-clang-format-cache
run: |
mkdir $GITHUB_WORKSPACE/clang-format-install
cp -r ~/bin/clang-format $GITHUB_WORKSPACE/clang-format-install
cp -r /usr/local/bin/clang-format $GITHUB_WORKSPACE/clang-format-install

Loading…
Cancel
Save