Skip to content

Commit

Permalink
Merge pull request #5 from sentoz/feature_update_workflow
Browse files Browse the repository at this point in the history
ci: add mdlint, hadolint and workflow for PR
  • Loading branch information
sentoz authored Nov 19, 2023
2 parents 0265d03 + 066dad5 commit 605b85f
Show file tree
Hide file tree
Showing 7 changed files with 370 additions and 15 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- '**.yaml'
- CNAME
- LICENSE

jobs:
shellcheck:
name: Check shell scripts
Expand All @@ -26,9 +27,21 @@ jobs:
reporter: github-pr-review
pattern: "*.sh"
exclude: "./.git/*"
mdlint:
name: MarkdownLint
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .
config_file: .markdownlint.yaml
ignore_files: ./LICENSE
build_base_images_focal:
name: Building a basic docker image on focal
needs: [shellcheck]
needs: [shellcheck, mdlint]
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -76,7 +89,7 @@ jobs:
file: Dockerfile.base-focal
build_base_images_jammy:
name: Building a basic docker image on jammy
needs: [shellcheck]
needs: [shellcheck, mdlint]
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down
197 changes: 197 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: Check pull request
on:
pull_request:
branches:
- 'main'
paths-ignore:
- '**.md'
- '**.png'
- '**.jpg'
- '**.svg'
- '**.yaml'
- CNAME
- LICENSE

concurrency:
# Cancel any running workflow for the same branch when new commits are pushed.
# We group both by ref_name (available when CI is triggered by a push to a branch/tag)
# and head_ref (available when CI is triggered by a PR).
group: "${{ github.workflow }}-${{ github.ref_name }}-${{ github.head_ref }}"
cancel-in-progress: true

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
reporter: github-pr-review
pattern: "*.sh"
exclude: "./.git/*"
- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .
config_file: .markdownlint.yaml
ignore_files: ./LICENSE
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

hadolint:
name: Hadolint
needs: [linters]
permissions:
pull-requests: write
issues: write
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: hadolint
id: hadolint
uses: hadolint/hadolint-action@v3.1.0
with:
recursive: true
- name: Update Pull Request
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
const output = `
#### Hadolint: \`${{ steps.hadolint.outcome }}\`
\`\`\`
${process.env.HADOLINT_RESULTS}
\`\`\`
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})



test_build_images:
name: Test building all docker images
needs: [hadolint]
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
- name: Get PR Number
id: get-pr-number
uses: mgaitan/gha-get-pr-number@0.1
- name: Build base-focal image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: base-focal:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.base-focal
- name: Build base-jammy image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: base-jammy:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.base-jammy
- name: Build standart image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: standart:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile
build-args: |
BASE_IMAGE_NAME=base-jammy
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
- name: Build gradle 7.3.3 image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: gradle7:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.gradle-7.3.3
build-args: |
BASE_IMAGE_NAME=base-jammy
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
- name: Build gradle 8.1.1 image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: gradle8:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.gradle-8.1.1
build-args: |
BASE_IMAGE_NAME=base-jammy
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
- name: Build .Net 3.1 image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: dotnet3:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.dotnet-3.1
build-args: |
BASE_IMAGE_NAME=base-focal
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
- name: Build .Net 5.0 image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: dotnet5:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.dotnet-5.0
build-args: |
BASE_IMAGE_NAME=base-focal
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
- name: Build .Net 6.0 image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: dotnet6:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.dotnet-6.0
build-args: |
BASE_IMAGE_NAME=base-jammy
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
- name: Build .Net 7.0 image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: dotnet7:${{ steps.get-pr-number.outputs.number }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.dotnet-7.0
build-args: |
BASE_IMAGE_NAME=base-jammy
BASE_IMAGE_TAG=${{ steps.get-pr-number.outputs.number }}
79 changes: 79 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
default: true
extends: null
MD001: true
MD003:
style: "consistent"
MD004:
style: "consistent"
MD005: true
MD007:
indent: 2
start_indented: false
MD009:
br_spaces: 2
list_item_empty_lines: false
strict: false
MD010:
code_blocks: true
MD011: true
MD012:
maximum: 1
MD013:
line_length: 80
heading_line_length: 80
code_block_line_length: 120
code_blocks: false
tables: false
headings: true
headers: true
strict: false
stern: false
MD014: true
MD018: true
MD019: true
MD020: true
MD021: true
MD022:
lines_above: 1
lines_below: 1
MD023: true
MD024:
allow_different_nesting: false
siblings_only: true
MD026:
punctuation: ".,;:!。,;:!?"
MD027: true
MD028: true
MD029:
style: "one_or_ordered"
MD030:
ul_single: 1
ol_single: 1
ul_multi: 1
ol_multi: 1
MD031:
list_items: true
MD032: true
MD033:
allowed_elements: []
MD034: true
MD035:
style: "consistent"
MD036:
punctuation: ".,;:!?。,;:!?"
MD037: true
MD038: true
MD039: true
MD040: true
MD042: true
MD044:
names: []
code_blocks: true
MD045: true
MD046:
style: "consistent"
MD047: true
MD048:
style: "consistent"

47 changes: 37 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age,
body size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our Standards

Expand All @@ -16,31 +21,53 @@ Examples of behavior that contributes to creating a positive environment include

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may
be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at sentoz66@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `sentoz66@gmail.com`. The project
team will review and investigate all complaints, and will respond in a way
that it deems appropriate to the circumstances. The project team is obligated
to maintain confidentiality with regard to the reporter of an incident. Further
details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
Loading

0 comments on commit 605b85f

Please sign in to comment.