From ee81f2df15d498a7c4cd6098fee997411acc9a21 Mon Sep 17 00:00:00 2001 From: Yevhen Fabizhevskyi Date: Sun, 17 Jan 2021 21:01:28 +0900 Subject: [PATCH] Add "Super Linter" CI pipeline (#3) * Add Super Lint GitHub Action * Fix MD Lint errors * Add 'Create release' pipeline --- .github/ISSUE_TEMPLATE/bug_report.md | 25 +++++++++------ .github/pull_request_template.md | 10 +++--- .github/workflows/create-release.yml | 45 +++++++++++++++++++++++++++ .github/workflows/dockerfile-lint.yml | 20 ------------ .github/workflows/linter.yml | 25 +++++++++++++++ .github/workflows/security-tests.yml | 2 +- .github/workflows/shell-lint.yml | 15 --------- .github/workflows/yaml-lint.yml | 19 ----------- .vscode/settings.json | 8 +++++ .yamllint.yml | 7 ----- README.md | 4 ++- 11 files changed, 104 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/create-release.yml delete mode 100644 .github/workflows/dockerfile-lint.yml create mode 100644 .github/workflows/linter.yml delete mode 100644 .github/workflows/shell-lint.yml delete mode 100644 .github/workflows/yaml-lint.yml delete mode 100644 .yamllint.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1c3fc0f..cdf77f7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,25 +7,32 @@ assignees: fabasoad --- -**Describe the bug** +## Describe the bug + A clear and concise description of what the bug is. -**Steps to Reproduce** +## Steps to Reproduce + 1. Run '...' 2. See error -**Expected behavior** +## Expected behavior + A clear and concise description of what you expected to happen. -**Actual behavior** +## Actual behavior + A clear and concise description of what is happening now. -**Screenshots** +## Screenshots + If applicable, add screenshots to help explain your problem. -**Technical information (please complete the following information):** - - OS: [e.g. Windows 10 Enterprise v.1909 (OS Build 18363.720)] - - `pascal-action` version [e.g. 1.0.2] +## Technical information (please complete the following information) + +- OS: [e.g. Windows 10 Enterprise v.1909 (OS Build 18363.720)] +- `pascal-action` version [e.g. 1.0.2] + +## Additional context -**Additional context** Add any other context about the problem here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0378015..4c6d88f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,6 @@ -Closes # + + +Closes #{IssueNumber} ## Pull request checklist @@ -11,9 +13,9 @@ Please check if your PR fulfills the following requirements: ## Pull request type - + - + Please check the type of change your PR introduces: @@ -23,7 +25,7 @@ Please check the type of change your PR introduces: - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes -- [ ] Other (please describe): +- [ ] Other (please describe): ## What is the current behavior? diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..6224cac --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,45 @@ +--- +name: Create release + +on: + push: + branches: + - main + +jobs: + create_release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + - name: Get commits since last release + id: changes + uses: simbo/changes-since-last-release-action@v1 + - name: Get latest version + id: substring + run: | + ver=$(echo "${{ steps.changes.outputs.last-tag }}" | cut -c2-) + echo '::set-output name=version::'$ver + - name: Increase version + id: semver + uses: matt-FFFFFF/simple-semver@v0.1.0 + with: + semver-input: ${{ steps.substring.outputs.version }} + increment: p + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.semver.outputs.semver }} + release_name: v${{ steps.semver.outputs.semver }} + body: | + # Changes + + ${{ steps.changes.outputs.log }} + draft: false + prerelease: false diff --git a/.github/workflows/dockerfile-lint.yml b/.github/workflows/dockerfile-lint.yml deleted file mode 100644 index 8653454..0000000 --- a/.github/workflows/dockerfile-lint.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Dockerfile Lint - -on: - push: - paths: - - 'Dockerfile' - -jobs: - lint: - name: Lint - timeout-minutes: 3 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - uses: burdzwastaken/hadolint-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HADOLINT_ACTION_DOCKERFILE_FOLDER: ./ - HADOLINT_ACTION_COMMENT: false diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..dc29d20 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,25 @@ +--- +name: Lint + +on: + push: + branches: + - main + - 'bugfix/**' + - 'feature/**' + +jobs: + build: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - name: Lint Code Base + uses: github/super-linter@v3.14.4 + env: + VALIDATE_ALL_CODEBASE: true + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/security-tests.yml b/.github/workflows/security-tests.yml index f52fb50..7e89754 100644 --- a/.github/workflows/security-tests.yml +++ b/.github/workflows/security-tests.yml @@ -22,4 +22,4 @@ jobs: run: | docker build -t ${{ github.repository }}:${{ github.sha }} . snyk auth ${{ secrets.SNYK_API_TOKEN }} - snyk test --docker ${{ github.repository }}:${{ github.sha }} --file=Dockerfile + snyk test --docker ${{ github.repository }}:${{ github.sha }} --file=Dockerfile --exclude-base-image-vulns diff --git a/.github/workflows/shell-lint.yml b/.github/workflows/shell-lint.yml deleted file mode 100644 index b0afb18..0000000 --- a/.github/workflows/shell-lint.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Shell Lint - -on: - push: - paths: - - '**.sh' - -jobs: - lint: - name: Lint - timeout-minutes: 3 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - uses: bewuethr/shellcheck-action@v2.0.3 diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml deleted file mode 100644 index 10addc6..0000000 --- a/.github/workflows/yaml-lint.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: YAML Lint - -on: - push: - paths: - - '**.yml' - -jobs: - lint: - name: Lint - timeout-minutes: 3 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - uses: ibiqlik/action-yamllint@v3.0.0 - with: - config_file: .yamllint.yml - strict: false diff --git a/.vscode/settings.json b/.vscode/settings.json index 4a6364f..3075a95 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { + "editor.codeActionsOnSave": { + "source.fixAll": true, + "fixAll.eslint": true + }, "cSpell.words": [ "HADOLINT", "appium", @@ -7,6 +11,10 @@ "ibiqlik", "issuehunt", "liberapay", + "markdownlint", + "semver", + "simbo", + "vulns", "yamllint" ] } \ No newline at end of file diff --git a/.yamllint.yml b/.yamllint.yml deleted file mode 100644 index 169fc32..0000000 --- a/.yamllint.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -extends: default - -rules: - line-length: - max: 150 - level: warning diff --git a/README.md b/README.md index 9bf566b..6f8ecd5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ + + # Run Pascal script action -![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/fabasoad/pascal-action?include_prereleases) ![CI (latest)](https://github.com/fabasoad/pascal-action/workflows/CI%20(latest)/badge.svg) ![Functional tests](https://github.com/fabasoad/pascal-action/workflows/Functional%20tests/badge.svg) ![Security tests](https://github.com/fabasoad/pascal-action/workflows/Security%20tests/badge.svg) ![YAML Lint](https://github.com/fabasoad/pascal-action/workflows/YAML%20Lint/badge.svg) ![Dockerfile Lint](https://github.com/fabasoad/pascal-action/workflows/Dockerfile%20Lint/badge.svg) ![Shell Lint](https://github.com/fabasoad/pascal-action/workflows/Shell%20Lint/badge.svg) +![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/fabasoad/pascal-action?include_prereleases) ![CI (latest)](https://github.com/fabasoad/pascal-action/workflows/CI%20(latest)/badge.svg) ![Functional tests](https://github.com/fabasoad/pascal-action/workflows/Functional%20tests/badge.svg) ![Security tests](https://github.com/fabasoad/pascal-action/workflows/Security%20tests/badge.svg) ![Lint](https://github.com/fabasoad/pascal-action/workflows/Lint/badge.svg) This action runs Pascal script.