Skip to content

copyright year-now #320

copyright year-now

copyright year-now #320

Workflow file for this run

---
# Lint the code base and launch unit test at each push or pull request
name: Lint and test
on: # yamllint disable-line rule:truthy
push:
workflow_dispatch:
jobs:
linters:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
vendor:
- ubuntu
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: ouzi-dev/commit-status-updater@v2
with:
name: lint
status: pending
- name: Linting - Dockerfile
run: |
set -exo pipefail
./bin/dockerLint -f checkstyle | tee logs/docker-checkstyle.xml
- name: Linting - Shellcheck
run: |
set -exo pipefail
./bin/shellcheckLint -f checkstyle | \
tee logs/shellcheck-checkstyle.xml
- name: Linting - Framework
run: |
./bin/frameworkLint -f checkstyle --expected-warnings-count 72 |
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/buildBinFiles.log
- name: check megalinter version
run: |
set -exo pipefail
status=0
newVersion="$(./bin/megalinter --check-megalinter-version)" || status=$?
if [[ "${status}" != "0" ]] ; then
echo "::warning file=.mega-linter.yml,title=new version of megalinter available::${newVersion}"
fi
- name: Archive results
uses: actions/upload-artifact@v3
with:
name: linter-reports
path: |
logs/*.xml
logs/*.log
- uses: ouzi-dev/commit-status-updater@v2
if: always()
with:
name: lint
status: ${{ job.status }}
buildDockerImagesAndTest:
needs: linters
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
vendor:
- ubuntu
- alpine
bashTarVersion:
- '4.4'
- '5.0'
- '5.1'
include:
- vendor: ubuntu
bashImage: ubuntu:20.04
options: -j 30
- vendor: alpine
bashTarVersion: 4.4
bashImage: amd64/bash:4.4-alpine3.18
options: -j 30
- vendor: alpine
bashTarVersion: 5.0
bashImage: amd64/bash:5.0-alpine3.18
options: -j 30
- vendor: alpine
bashTarVersion: 5.1
bashImage: amd64/bash:5.1-alpine3.18
options: -j 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: ouzi-dev/commit-status-updater@v2
with:
name: build bash-tools-${{matrix.vendor}}-${{matrix.bashTarVersion}}
status: pending
- name: Pull/Build/Push docker image
env:
BRANCH: ${{ github.ref }}
run: |
./bin/buildPushDockerImage \
--vendor "${{matrix.vendor}}" \
--bash-version "${{matrix.bashTarVersion}}" \
--bash-base-image "${{matrix.bashImage}}" \
--branch-name "${BRANCH}" \
--push -vvv
- name: Check image
run: |
docker run --rm \
"build:bash-tools-${{matrix.vendor}}-${{matrix.bashTarVersion}}" bash \
--version
- name: run unit tests
run: |
chmod -R 777 logs
# shellcheck disable=SC2266
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:
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 }}
publishTestResults:
name: 'Publish Tests Results'
if: ${{ always() }}
needs: [linters, buildDockerImagesAndTest]
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@v2
with:
path: artifacts
- name: Checkstyle aggregation
uses: jwgmeligmeyling/checkstyle-github-action@master
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
- uses: ouzi-dev/commit-status-updater@v2
with:
name: build
# neutral, success, skipped, cancelled, timed_out, action_required, failure
status: ${{ env.WORKFLOW_CONCLUSION }}