From d1f848f56e74dce12a6910f675a5310bd0275a25 Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Tue, 1 Feb 2022 09:34:02 +0100 Subject: ci: Use Differential ShellCheck action (cherry picked from commit 3eee59032cd3f1793d13fe16dbd609d350d5fbb7) --- .github/.diff-shellcheck-exceptions.txt | 4 ++++ .github/.diff.shellcheck-scripts.txt | 38 +++++++++++++++++++++++++++++++++ .github/workflows/exception-list.txt | 4 ---- .github/workflows/script-list.txt | 38 --------------------------------- .github/workflows/shellcheck_test.yml | 31 +++++++++++---------------- README.md | 8 ++++++- 6 files changed, 62 insertions(+), 61 deletions(-) create mode 100644 .github/.diff-shellcheck-exceptions.txt create mode 100644 .github/.diff.shellcheck-scripts.txt delete mode 100644 .github/workflows/exception-list.txt delete mode 100644 .github/workflows/script-list.txt diff --git a/.github/.diff-shellcheck-exceptions.txt b/.github/.diff-shellcheck-exceptions.txt new file mode 100644 index 00000000..5b093820 --- /dev/null +++ b/.github/.diff-shellcheck-exceptions.txt @@ -0,0 +1,4 @@ +# List of Shelcheck codes which should be excluded from ci output +# Avoid spaces in list since they are counted as comment +SC1090 # Ignore when shellcheck can't follow non-constant source e.g. ``. "${path}"`` +SC2148 # Ignore missing shebang diff --git a/.github/.diff.shellcheck-scripts.txt b/.github/.diff.shellcheck-scripts.txt new file mode 100644 index 00000000..053672df --- /dev/null +++ b/.github/.diff.shellcheck-scripts.txt @@ -0,0 +1,38 @@ +# Tracker of all shell scripts in this repository +# Every new script should be added in order to test it with ci +# Avoid spaces in list since they are counted as comment +etc/rc.d/init.d/functions +etc/rc.d/init.d/network +network-scripts/ifdown-bnep +network-scripts/ifdown-ippp +network-scripts/ifdown-post +network-scripts/ifdown-sit +network-scripts/ifup +network-scripts/ifup-bnep +network-scripts/ifup-eth +network-scripts/ifup-ipv6 +network-scripts/ifup-plusb +network-scripts/ifup-routes +network-scripts/ifup-tunnel +network-scripts/init.ipv6-global +network-scripts/network-functions-ipv6 +network-scripts/ifdown +network-scripts/ifdown-eth +network-scripts/ifdown-ipv6 +network-scripts/ifdown-routes +network-scripts/ifdown-tunnel +network-scripts/ifup-aliases +network-scripts/ifup-ctc +network-scripts/ifup-ippp +network-scripts/ifup-plip +network-scripts/ifup-post +network-scripts/ifup-sit +network-scripts/ifup-wireless +network-scripts/network-functions +usr/libexec/import-state +usr/libexec/loadmodules +usr/libexec/netconsole +usr/libexec/readonly-root +usr/sbin/service +.ci/check-shell.sh +.ci/functions.sh diff --git a/.github/workflows/exception-list.txt b/.github/workflows/exception-list.txt deleted file mode 100644 index 5b093820..00000000 --- a/.github/workflows/exception-list.txt +++ /dev/null @@ -1,4 +0,0 @@ -# List of Shelcheck codes which should be excluded from ci output -# Avoid spaces in list since they are counted as comment -SC1090 # Ignore when shellcheck can't follow non-constant source e.g. ``. "${path}"`` -SC2148 # Ignore missing shebang diff --git a/.github/workflows/script-list.txt b/.github/workflows/script-list.txt deleted file mode 100644 index 053672df..00000000 --- a/.github/workflows/script-list.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Tracker of all shell scripts in this repository -# Every new script should be added in order to test it with ci -# Avoid spaces in list since they are counted as comment -etc/rc.d/init.d/functions -etc/rc.d/init.d/network -network-scripts/ifdown-bnep -network-scripts/ifdown-ippp -network-scripts/ifdown-post -network-scripts/ifdown-sit -network-scripts/ifup -network-scripts/ifup-bnep -network-scripts/ifup-eth -network-scripts/ifup-ipv6 -network-scripts/ifup-plusb -network-scripts/ifup-routes -network-scripts/ifup-tunnel -network-scripts/init.ipv6-global -network-scripts/network-functions-ipv6 -network-scripts/ifdown -network-scripts/ifdown-eth -network-scripts/ifdown-ipv6 -network-scripts/ifdown-routes -network-scripts/ifdown-tunnel -network-scripts/ifup-aliases -network-scripts/ifup-ctc -network-scripts/ifup-ippp -network-scripts/ifup-plip -network-scripts/ifup-post -network-scripts/ifup-sit -network-scripts/ifup-wireless -network-scripts/network-functions -usr/libexec/import-state -usr/libexec/loadmodules -usr/libexec/netconsole -usr/libexec/readonly-root -usr/sbin/service -.ci/check-shell.sh -.ci/functions.sh diff --git a/.github/workflows/shellcheck_test.yml b/.github/workflows/shellcheck_test.yml index 6ad63a58..40436b6f 100644 --- a/.github/workflows/shellcheck_test.yml +++ b/.github/workflows/shellcheck_test.yml @@ -1,28 +1,23 @@ -# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: Shellcheck test +name: Differential ShellCheck on: + push: + branches: [master, rhel*-branch] pull_request: - branches: - - master - - rhel*-branch + branches: [master, rhel*-branch] jobs: shellCheck: runs-on: ubuntu-20.04 - defaults: - run: - shell: bash - steps: - - name: Install dependencies - run: sudo apt update && sudo apt-get install -y cmake help2man libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev tree - - name: Clone csdiff repository - run: cd ../ && git clone --depth=1 https://github.com/csutils/csdiff.git && cd - - - name: Build and install csdiff - run: cd ../csdiff && sudo make && sudo make install && cd - - - name: Repository checkout + + steps: + - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - name: Run shell-check test - run: bash ./.github/workflows/check-shell.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} + + - name: Differential ShellCheck + uses: redhat-plumbers-in-action/differential-shellcheck@v1 + with: + ignored-codes: .github/.diff-shellcheck-exceptions.txt + shell-scripts: .github/.diff.shellcheck-scripts.txt diff --git a/README.md b/README.md index 9f7c27ad..60196c1d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# initscripts | [![Build Status](https://github.com/fedora-sysv/initscripts/workflows/Integration%20test/badge.svg)](https://github.com/fedora-sysv/initscripts/actions?query=workflow%3AIntegration+test) [![Shellcheck Status](https://github.com/fedora-sysv/initscripts/workflows/Shellcheck%20test/badge.svg)](https://github.com/fedora-sysv/initscripts/actions?query=workflow%3AShellcheck+test) +# initscripts + +[![Build Status](https://github.com/fedora-sysv/initscripts/workflows/Integration%20test/badge.svg)](https://github.com/fedora-sysv/initscripts/actions?query=workflow%3AIntegration+test) [![Differential ShellCheck](https://github.com/fedora-sysv/initscripts/actions/workflows/shellcheck_test.yml/badge.svg)](https://github.com/fedora-sysv/initscripts/actions/workflows/shellcheck_test.yml) [![Total alerts](https://img.shields.io/lgtm/alerts/g/fedora-sysv/initscripts.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fedora-sysv/initscripts/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/fedora-sysv/initscripts.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fedora-sysv/initscripts/context:python) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/fedora-sysv/initscripts.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fedora-sysv/initscripts/context:cpp) [![Mergify Status][mergify-status]][mergify] + +[mergify]: https://mergify.io +[mergify-status]: https://img.shields.io/endpoint.svg?url=https://dashboard.mergify.io/badges/fedora-sysv/initscripts&style=flat + This repository contains source code for **legacy** *System V [initscripts](https://en.wikipedia.org/wiki/Init)*, which are primarily used in *[Linux](https://en.wikipedia.org/wiki/Linux) distributions like e.g.*: * [Fedora](https://en.wikipedia.org/wiki/Fedora_(operating_system)) -- cgit v1.2.1