-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use bash-tools-framework pre-commit hooks
- Loading branch information
1 parent
cbee165
commit 1a91f95
Showing
9 changed files
with
88 additions
and
152 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
# Lint the code base and launch unit test at each push or pull request | ||
name: Lint and test | ||
on: | ||
on: # yamllint disable-line rule:truthy | ||
push: | ||
workflow_dispatch: | ||
|
||
|
@@ -10,55 +10,44 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
vendor: | ||
- ubuntu | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
|
||
- uses: ouzi-dev/commit-status-updater@v2 | ||
with: | ||
name: lint | ||
status: pending | ||
|
||
- name: Install vendors | ||
run: | | ||
set -exo pipefail | ||
./bin/installRequirements | ||
- name: Linting - Shellcheck | ||
run: | | ||
set -exo pipefail | ||
./bin/shellcheckLint -f checkstyle | tee logs/shellcheck-checkstyle.xml | ||
- name: Linting - Framework | ||
run: | | ||
set -exo pipefail | ||
./bin/frameworkLint -f checkstyle | tee logs/framework-checkstyle.xml | ||
- name: Linting - Awk | ||
run: | | ||
set -exo pipefail | ||
./bin/awkLint | tee logs/awk-checkstyle.xml | ||
- name: build bin files + check md5 | ||
run: | | ||
set -exo pipefail | ||
./bin/buildBinFiles 2>&1 | tee logs/buidBinFiles.log | ||
- name: Checkstyle aggregation | ||
uses: jwgmeligmeyling/checkstyle-github-action@master | ||
with: | ||
path: 'logs/*-checkstyle.xml' | ||
- name: Run pre-commit | ||
run: pre-commit run -a --hook-stage manual | ||
|
||
- name: Archive results | ||
if: ${{ always() }} | ||
continue-on-error: true | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: linter-reports | ||
path: | | ||
logs/*.xml | ||
logs/*.log | ||
megalinter-reports/** | ||
- name: Create Pull Request | ||
if: ${{ failure() }} | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
branch: update/pre-commit-fixes | ||
title: lint fixes | ||
commit-message: Auto-update lint fixes | ||
body: | | ||
some auto fixes have been generated during pre-commit run | ||
labels: updates | ||
|
||
- uses: ouzi-dev/commit-status-updater@v2 | ||
if: always() | ||
|
@@ -82,10 +71,10 @@ jobs: | |
include: | ||
- vendor: ubuntu | ||
bashImage: ubuntu:20.04 | ||
options: -j 1 | ||
options: -j 30 | ||
- vendor: alpine | ||
bashImage: bash | ||
options: -j 1 | ||
options: -j 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
@@ -110,34 +99,56 @@ jobs: | |
./bin/installRequirements | ||
chmod -R 777 logs | ||
# shellcheck disable=SC2266 | ||
VENDOR="${{ matrix.vendor }}" \ | ||
BASH_TAR_VERSION="${{ matrix.bashTarVersion }}" \ | ||
BASH_IMAGE="${{ matrix.bashImage }}" \ | ||
SKIP_BUILD=0 \ | ||
SKIP_USER=1 \ | ||
./bin/test ${{matrix.options}} --report-formatter junit -o logs -r src | ||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v1 | ||
USER_ID=1000 \ | ||
GROUP_ID=1000 \ | ||
./bin/test \ | ||
-vvv \ | ||
--vendor "${{matrix.vendor}}" \ | ||
--bash-version "${{matrix.bashTarVersion}}" \ | ||
--bash-base-image "${{matrix.bashImage}}" \ | ||
--branch-name "${BRANCH}" \ | ||
${{matrix.options}} --report-formatter junit -o logs -r src --ci | ||
- name: Upload Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
files: logs/report.xml | ||
check_name: | ||
'Unit Test Results ${{matrix.vendor}} ${{matrix.bashTarVersion}}' | ||
name: Test Results ${{matrix.vendor}} ${{matrix.bashTarVersion}} | ||
path: logs/report.xml | ||
|
||
- uses: ouzi-dev/commit-status-updater@v2 | ||
if: always() | ||
with: | ||
name: build bash-tools-${{matrix.vendor}}-${{matrix.bashTarVersion}} | ||
status: ${{ job.status }} | ||
|
||
buildResults: | ||
publishTestResults: | ||
name: 'Publish Tests Results' | ||
if: ${{ always() }} | ||
runs-on: ubuntu-latest | ||
name: Final Build Results | ||
needs: [linters, tests] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
checks: write | ||
|
||
# needed by ouzi-dev/commit-status-updater@v2 | ||
statuses: write | ||
|
||
# only needed unless run with comment_mode: off | ||
pull-requests: write | ||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts | ||
|
||
- name: Checkstyle aggregation | ||
uses: lcollins/[email protected] | ||
with: | ||
path: 'artifacts/**/*.xml' | ||
|
||
# run this action to get the workflow conclusion | ||
# You can get the conclusion via env (env.WORKFLOW_CONCLUSION) | ||
- uses: technote-space/workflow-conclusion-action@v3 | ||
|
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
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
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
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
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
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
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