Skip to content

Commit acf9799

Browse files
committed
ci: Add GitHub Workflow for running uncrustify
1 parent 3ba2ccc commit acf9799

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/format.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
2+
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
3+
name: format
4+
5+
on:
6+
push:
7+
branches:
8+
- 'master'
9+
- 'releases/**'
10+
- '1.*'
11+
tags:
12+
- '1.*'
13+
pull_request:
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build:
20+
21+
runs-on: ubuntu-22.04
22+
23+
defaults:
24+
run:
25+
shell: bash -euo pipefail {0}
26+
27+
env:
28+
UNCRUSTIFY_INSTALL_DIR: ${{ github.workspace }}/runformat-uncrustify
29+
30+
steps:
31+
- uses: actions/checkout@v5
32+
with:
33+
persist-credentials: false
34+
35+
- name: Determine uncrustify version
36+
id: get-uncrustify-version
37+
run: |
38+
version="$(./runformat --expected-uncrustify-version)"
39+
echo "Expected uncrustify version: $version"
40+
echo "version=$version" >> "$GITHUB_OUTPUT"
41+
42+
- name: Set UNCRUSTIFY_VERSION env variable
43+
run: |
44+
version=$(./runformat --expected-uncrustify-version)
45+
echo "version [$version]"
46+
echo "UNCRUSTIFY_VERSION=${version}" >> "$GITHUB_ENV"
47+
48+
- name: Cache uncrustify
49+
uses: actions/cache@v4
50+
id: cache-uncrustify
51+
with:
52+
path: ${{ env.UNCRUSTIFY_INSTALL_DIR }}
53+
key: ${{ runner.os }}-uncrustify-${{ steps.get-uncrustify-version.outputs.version }}
54+
55+
- name: Install uncrustify
56+
if: steps.cache-uncrustify.outputs.cache-hit != 'true'
57+
run: |
58+
./runformat --install --install-dir "${UNCRUSTIFY_INSTALL_DIR}"
59+
60+
- name: Uncrustify check
61+
run: |
62+
./runformat

0 commit comments

Comments
 (0)