From a3086aedcb696c63ff9ca3d051bbcfe22c241faa Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 17:17:37 -0500 Subject: [PATCH 01/11] [docs][README] Use updated release tag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bfe2f4a..3370594 100644 --- a/README.md +++ b/README.md @@ -41,5 +41,5 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run clang-format style check for C/C++ programs. - uses: jidicula/clang-format-action@v1.1.2 + uses: jidicula/clang-format-action@v2.0.0 ``` From b241d1cb47772f860e86c035529fbacd473560dd Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:09:02 -0500 Subject: [PATCH 02/11] [docs][README] Recommend trigger on PR --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3370594..e168786 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To use this action, create a `.github/workflows/clang-format-check.yml` in your ``` name: clang-format Check -on: [push] +on: [push, PR] jobs: formatting-check: name: Formatting Check From b0a105447f19c96afd3454336c9d283a2081ef09 Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:34:10 -0500 Subject: [PATCH 03/11] [feat][CI] Check styling of shellscripts **Why this change was necessary** Previously there was no check for shellscript formatting. **What this change does** Adds a GHA Workflow for installing shfmt and checking all shellscripts in the repo for correct formatting. **Any side-effects?** Possibly some red crosses --- .github/workflows/shfmt.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/shfmt.yml diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml new file mode 100644 index 0000000..bb68db0 --- /dev/null +++ b/.github/workflows/shfmt.yml @@ -0,0 +1,33 @@ +name: shfmt + +on: + push: + branches: + - main + - dev + paths: + - '**.sh' + - '.github/workflows/shfmt.yml' + pull_request: + branches: + - main + - dev + paths: + - '**.sh' + - '.github/workflows/shfmt.yml' + +jobs: + format: + env: + SHFMT_VERSION: 3.0.1 + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - name: Install shfmt + run: wget "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -O /usr/local/bin/shfmt + + - name: Check .sh files + run: shfmt -d . + From 9b4fd07d1f653817fe1f7903aeb5b45637b88a7f Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:35:37 -0500 Subject: [PATCH 04/11] [fix][CI] Use sudo when installing shfmt --- .github/workflows/shfmt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml index bb68db0..470dd30 100644 --- a/.github/workflows/shfmt.yml +++ b/.github/workflows/shfmt.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/checkout@v2 - name: Install shfmt - run: wget "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -O /usr/local/bin/shfmt + run: sudo wget "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -O /usr/local/bin/shfmt - name: Check .sh files run: shfmt -d . From e6c25d85acc4e340486c8854c103fcdb171a6e6d Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:37:32 -0500 Subject: [PATCH 05/11] [fix][CI] Make shfmt executable --- .github/workflows/shfmt.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml index 470dd30..d704416 100644 --- a/.github/workflows/shfmt.yml +++ b/.github/workflows/shfmt.yml @@ -26,7 +26,9 @@ jobs: - uses: actions/checkout@v2 - name: Install shfmt - run: sudo wget "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -O /usr/local/bin/shfmt + run: | + sudo wget "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -O /usr/local/bin/shfmt + sudo chmod +x /usr/local/bin/shfmt - name: Check .sh files run: shfmt -d . From d23b9a43ebff0fe786d1c16b3e0277d1ae377211 Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:40:22 -0500 Subject: [PATCH 06/11] [style][CI] Remove declarative comments --- .github/workflows/shellcheck.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index fae8822..16eb59b 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,8 +1,5 @@ -# This is a basic workflow to help you get started with Actions - name: shellcheck -# Controls when the action will run. on: push: branches: @@ -19,18 +16,12 @@ on: - 'entrypoint.sh' - '.github/workflows/shellcheck.yml' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - # Runs a single command using the runners shell - uses: ludeeus/action-shellcheck@1.0.0 From d0217eefb06b711194684cc4ef3316dd1d15d7ca Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:40:57 -0500 Subject: [PATCH 07/11] [feat][CI] Run Shellcheck on any shellscript changes --- .github/workflows/shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 16eb59b..0d8b34b 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -6,14 +6,14 @@ on: - main - dev paths: - - 'entrypoint.sh' + - '**.sh' - '.github/workflows/shellcheck.yml' pull_request: branches: - main - dev paths: - - 'entrypoint.sh' + - '**.sh' - '.github/workflows/shellcheck.yml' jobs: From 770cf928408687c921bd3df0ab44cb54ca5e1c70 Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:41:18 -0500 Subject: [PATCH 08/11] [feat][CI] Use Ubuntu 20.04 --- .github/workflows/dockerimage.yml | 2 +- .github/workflows/shellcheck.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 4262656..c3d9c54 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -22,7 +22,7 @@ jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 0d8b34b..3be4070 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -17,8 +17,8 @@ on: - '.github/workflows/shellcheck.yml' jobs: - build: - runs-on: ubuntu-latest + lint: + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 From be0946349d2504c316ad7fee0b52b61b86d5f54a Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:44:20 -0500 Subject: [PATCH 09/11] [feat][CI] Make shfmt depend on shellcheck workflow **Why this change was necessary** Formatting checks should only be run if the syntax is correct. **What this change does** See title **Any side-effects?** None --- .github/workflows/shfmt.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml index d704416..78bc078 100644 --- a/.github/workflows/shfmt.yml +++ b/.github/workflows/shfmt.yml @@ -21,6 +21,7 @@ jobs: env: SHFMT_VERSION: 3.0.1 runs-on: ubuntu-20.04 + needs: lint steps: - uses: actions/checkout@v2 From c4f79987b780cc66f82e412e7676525cc051024a Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 18:48:44 -0500 Subject: [PATCH 10/11] Revert be09463 --- .github/workflows/shfmt.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml index 78bc078..d704416 100644 --- a/.github/workflows/shfmt.yml +++ b/.github/workflows/shfmt.yml @@ -21,7 +21,6 @@ jobs: env: SHFMT_VERSION: 3.0.1 runs-on: ubuntu-20.04 - needs: lint steps: - uses: actions/checkout@v2 From a0fd56b2fc98d0cac73ee8f7b0f9ccc8010fb4ab Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 26 Dec 2020 19:01:09 -0500 Subject: [PATCH 11/11] [docs][README] Add badges for each workflow --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e168786..d08b661 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +| Tag | Docker Image CI | shellcheck | shfmt | +|--------|-----------------|------------|-------| +| v2.0.0 | ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg?branch=v2.0.0) | ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg?branch=v2.0.0) | ![shfmt](https://github.com/jidicula/clang-format-action/workflows/shfmt/badge.svg?branch=v2.0.0) | +| main | ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg?branch=main) | ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg?branch=main) | ![shfmt](https://github.com/jidicula/clang-format-action/workflows/shfmt/badge.svg?branch=main) | +| dev | ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg?branch=dev) | ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg?branch=dev) | ![shfmt](https://github.com/jidicula/clang-format-action/workflows/shfmt/badge.svg?branch=dev) | + ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg) ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg) # clang-format-action GitHub Action for clang-format