2024-09-15 18:37:09 +00:00
|
|
|
---
|
2020-12-17 14:41:10 +00:00
|
|
|
# DESCRIPTION: Github actions config
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2024-09-15 18:37:09 +00:00
|
|
|
#
|
2021-06-09 20:44:37 +00:00
|
|
|
name: format
|
2020-12-17 14:41:10 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request_target:
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
format:
|
2022-09-28 01:47:45 +00:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
name: Ubuntu 22.04 | format
|
2020-12-17 14:41:10 +00:00
|
|
|
env:
|
|
|
|
CI_OS_NAME: linux
|
2022-09-28 01:47:45 +00:00
|
|
|
CI_RUNS_ON: ubuntu-22.04
|
2020-12-17 14:41:10 +00:00
|
|
|
CI_COMMIT: ${{ github.sha }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-01-23 03:32:00 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-12-17 14:41:10 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install packages for build
|
|
|
|
env:
|
|
|
|
CI_BUILD_STAGE_NAME: build
|
|
|
|
run: |
|
|
|
|
bash ci/ci-install.bash &&
|
2022-09-28 01:47:45 +00:00
|
|
|
sudo apt-get install clang-format-14 yapf3 &&
|
2020-12-17 14:41:10 +00:00
|
|
|
git config --global user.email "action@example.com" &&
|
|
|
|
git config --global user.name "github action"
|
|
|
|
- name: Format code
|
|
|
|
run: |
|
|
|
|
autoconf &&
|
|
|
|
./configure &&
|
2022-09-28 01:47:45 +00:00
|
|
|
make -j 2 format CLANGFORMAT=clang-format-14 &&
|
2020-12-17 14:41:10 +00:00
|
|
|
git status
|
|
|
|
- name: Push
|
|
|
|
run: |
|
|
|
|
if [ -n "$(git status --porcelain)" ]; then
|
2021-06-09 20:44:37 +00:00
|
|
|
git commit . -m "Apply 'make format'" &&
|
2020-12-17 14:41:10 +00:00
|
|
|
git push origin
|
|
|
|
fi
|