ci(workflow): fix gradle configuration #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Tests" | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
lint-commits: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Lint Commits | |
uses: wagoid/commitlint-github-action@v6 | |
with: | |
failOnWarnings: true | |
failOnErrors: true | |
prettier: | |
# Job requires Variables to be defined as follows: | |
# secrets.PUSH_TOKEN -> Password with rights to push to repository | |
# and trigger new workflow execution | |
runs-on: ubuntu-latest | |
needs: | |
- lint-commits | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.PUSH_TOKEN }} | |
- name: Setup NPM | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21 | |
- name: Install NodeJS Dependencies | |
run: npm clean-install | |
- name: Run Prettier | |
run: npx prettier --write "**/*.{md,yaml,js,html,java,properties}" | |
- name: Commit Changes | |
id: auto-commit | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "style(all): apply prettier to '${{ github.head_ref }}'" | |
commit_user_name: github-actions | |
commit_user_email: action@github.com | |
commit_author: github-actions <action@github.com> | |
- name: Check For Updated Files | |
id: check-further-execution | |
if: steps.auto-commit.outputs.changes_detected =='true' | |
run: | | |
echo "Updates detected. Abort Workflow execution!" | | |
exit 1 | |
clang-format: | |
runs-on: ubuntu-latest | |
needs: | |
- lint-commits | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.PUSH_TOKEN }} | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "17" | |
directory: ${{ runner.temp }}/llvm | |
- name: Get C Files | |
run: | | |
echo SRC=$(git ls-tree --full-tree -r HEAD | grep -e "\.\(c\|h\)\$" | cut -f 2 | grep -v ^extern) >> $GITHUB_ENV | |
- name: Apply clang-format to Files | |
run: | | |
clang-format --style=file --fallback-style=llvm -i $SRC | |
- name: Commit Changes | |
id: auto-commit | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "style(all): apply clang-format to '${{ github.head_ref }}'" | |
commit_user_name: github-actions | |
commit_user_email: action@github.com | |
commit_author: github-actions <action@github.com> | |
- name: Check For Updated Files | |
id: check-further-execution | |
if: steps.auto-commit.outputs.changes_detected =='true' | |
run: | | |
echo "Updates detected. Abort Workflow execution!" | | |
exit 1 |