Skip to content

Commit

Permalink
Merge pull request #48 from github/try-super-linter
Browse files Browse the repository at this point in the history
Try out the super-linter
  • Loading branch information
zkoppert authored Nov 3, 2023
2 parents 997b977 + 502e761 commit 6399759
Show file tree
Hide file tree
Showing 25 changed files with 294 additions and 106 deletions.
2 changes: 2 additions & 0 deletions .github/linters/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 150
7 changes: 7 additions & 0 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"threshold": 25,
"ignore": [
"test*"
],
"absolute": true
}
26 changes: 26 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
###########################
###########################
## Markdown Linter rules ##
###########################
###########################

# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#

###############
# Rules by id #
###############
# line length
MD013: false
# singe h1
MD025: false
# duplicate headers
MD024: false
4 changes: 4 additions & 0 deletions .github/linters/.mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Global options:

[mypy]
disable_error_code = attr-defined, import-not-found
2 changes: 2 additions & 0 deletions .github/linters/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Don't suggest [ -n "$VAR" ] over [ ! -z "$VAR" ]
disable=SC2129
10 changes: 10 additions & 0 deletions .github/linters/.textlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"filters": {
"comments": true
},
"rules": {
"terminology": {
"severity": "warning"
}
}
}
59 changes: 59 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
###########################################
# These are the rules used for #
# linting all the yaml files in the stack #
# NOTE: #
# You can disable line with: #
# # yamllint disable-line #
###########################################
rules:
braces:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
brackets:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
colons:
level: warning
max-spaces-before: 0
max-spaces-after: 1
commas:
level: warning
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments: disable
comments-indentation: disable
document-end: disable
document-start:
level: warning
present: true
empty-lines:
level: warning
max: 2
max-start: 0
max-end: 0
hyphens:
level: warning
max-spaces-after: 1
indentation:
level: warning
spaces: consistent
indent-sequences: true
check-multi-line-strings: false
key-duplicates: enable
line-length:
level: warning
max: 1024
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Pull Request
<!-- PR title should be brief and descriptive for a good changelog entry -->

## Proposed Changes
Expand All @@ -6,9 +7,11 @@
## Readiness Checklist

### Author/Contributor

- [ ] If documentation is needed for this change, has that been included in this pull request
- [ ] run `make lint` and fix any issues that you have introduced
- [ ] run `make test` and ensure you have test coverage for the lines you are introducing

### Reviewer

- [ ] Label as either `bug`, `documentation`, `enhancement`, `infrastructure`, or `breaking`
60 changes: 30 additions & 30 deletions .github/workflows/contributors_report.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Monthly contributor report
on:
workflow_dispatch:
Expand All @@ -13,33 +14,32 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: Get dates for last month
shell: bash
run: |
# Calculate the first day of the previous month
start_date=$(date -d "last month" +%Y-%m-01)
# Calculate the last day of the previous month
end_date=$(date -d "$start_date +1 month -1 day" +%Y-%m-%d)
#Set an environment variable with the date range
echo "START_DATE=$start_date" >> "$GITHUB_ENV"
echo "END_DATE=$end_date" >> "$GITHUB_ENV"
- name: Run contributor action
uses: github/contributors@v1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
START_DATE: ${{ env.START_DATE }}
END_DATE: ${{ env.END_DATE }}
REPOSITORY: github/contributors
SPONSOR_INFO: "true"

- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Monthly contributor report
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ./contributors.md
assignees: zkoppert
- name: Get dates for last month
shell: bash
run: |
# Calculate the first day of the previous month
start_date=$(date -d "last month" +%Y-%m-01)
# Calculate the last day of the previous month
end_date=$(date -d "$start_date +1 month -1 day" +%Y-%m-%d)

#Set an environment variable with the date range
echo "START_DATE=$start_date" >> "$GITHUB_ENV"
echo "END_DATE=$end_date" >> "$GITHUB_ENV"

- name: Run contributor action
uses: github/contributors@v1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
START_DATE: ${{ env.START_DATE }}
END_DATE: ${{ env.END_DATE }}
REPOSITORY: github/contributors
SPONSOR_INFO: "true"

- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Monthly contributor report
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ./contributors.md
assignees: zkoppert
11 changes: 6 additions & 5 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
name: Docker Image CI

on:
push:
branches: [ main ]
branches: main
pull_request:
branches: [ main ]
branches: main

jobs:

Expand All @@ -13,6 +14,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --platform linux/amd64
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --platform linux/amd64
16 changes: 9 additions & 7 deletions .github/workflows/major-version-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Major Version Updater
# Whenever a new release is made, push a major version tag
on:
release:
types: [ published ]
types: published

jobs:
update-major-version-tag:
Expand All @@ -14,13 +14,15 @@ jobs:

- name: version
id: version
shell: bash
run: |
tag=${GITHUB_REF/refs\/tags\//}
version=${tag#v}
major=${version%%.*}
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "major=${major}" >> "$GITHUB_OUTPUT"
# shellcheck disable=all
tag=${GITHUB_REF/refs\/tags\//};
version=${tag#v} ;
major=${version%%.*} ;
echo "tag=${tag}" >> "$GITHUB_OUTPUT" ;
echo "version=${version}" >> "$GITHUB_OUTPUT" ;
echo "major=${major}" >> "$GITHUB_OUTPUT" ;
- name: force update major tag
run: |
Expand Down
39 changes: 20 additions & 19 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
---
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ main ]
branches: main
pull_request:
branches: [ main ]
branches: main

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.11, 3.12]
python-version: [3.11, 3.12]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pylint pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8 and pylint
run: |
make lint
- name: Test with pytest
run: |
make test
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pylint pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8 and pylint
run: |
make lint
- name: Test with pytest
run: |
make test
1 change: 1 addition & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Release Drafter

on:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/super-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
#################################
#################################
## Super Linter GitHub Actions ##
#################################
#################################
name: Lint Code Base

#############################
# Start the job on all push #
#############################
on:
pull_request:
branches: main

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

############################################
# Grant status permission for MULTI_STATUS #
############################################
permissions:
contents: read
packages: read
statuses: write

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: super-linter/super-linter@v5
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTIONS_COMMAND_ARGS: -shellcheck=
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ We will then take care of the issue as soon as possible.

## I Want To Contribute

> ### Legal Notice <!-- omit in toc -->
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
### Legal Notice <!-- omit in toc -->

When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.

## Reporting Bugs

Expand Down Expand Up @@ -92,6 +93,7 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/github

To release a new version, maintainers are to release new versions following semantic versioning and via GitHub Releases.
Once the code is ready to release please do the following

1. Create a [GitHub release](https://github.com/github/contributors/releases) based off the current draft and review release notes
2. Ensure that the versioning is correct given the content of the release
3. Check the box to release it to the GitHub Marketplace
Expand Down
Loading

0 comments on commit 6399759

Please sign in to comment.