Skip to content

Develop #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.py]
indent_style = space
indent_size = 4

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
Expand Down
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
---

version: 2
updates:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
name: "CodeQL"

on:
on: # yamllint disable-line rule:truthy
push:
branches: [ "main", "develop", "feature/*" ]
branches: ["main", "develop", "feature/*"]
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: "52 12 * * 1"

Expand All @@ -20,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ python ]
language: [python]

steps:
- name: Checkout
Expand Down
69 changes: 38 additions & 31 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
---
name: Docker Image CI

on:
on: # yamllint disable-line rule:truthy
push:
branches: [ "main", "develop", "feature/*" ]
branches: ["main", "develop", "feature/*"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:

build:
name: "Build & Test in Docker"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Build the Docker image
run: make compose/rebuild
- name: Run static checks in Docker image
run: make compose/lint
- name: Run test in Docker image
run: make compose/run
- name: Tag Docker image
run: docker tag algorithm-exercises-py:latest algorithm-exercises-py:${{ github.sha }}

- name: Run Snyk to check Docker image for vulnerabilities
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning
continue-on-error: true
uses: snyk/actions/docker@master
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
# or you can sign up for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: algorithm-exercises-py:latest
args: --file=Dockerfile
# - name: Upload result to GitHub Code Scanning
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: snyk.sarif
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Build the Docker image
run: make compose/rebuild
- name: Run static checks in Docker image
run: make compose/lint
- name: Run test in Docker image
run: make compose/run
- name: Tag Docker image
run: >
docker tag
algorithm-exercises-py:latest
algorithm-exercises-py:${{ github.sha }}
- name: Run Snyk to check Docker image for vulnerabilities
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning
continue-on-error: true
uses: snyk/actions/docker@master
env:
# yamllint disable rule:line-length
# In order to use the Snyk Action you will need to have
# a Snyk API token.
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
# or you can sign up for free at https://snyk.io/login
# yamllint enable rule:line-length
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: algorithm-exercises-py:latest
args: --file=Dockerfile
# yamllint disable rule:comments-indentation
# - name: Upload result to GitHub Code Scanning
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: snyk.sarif
# yamllint enable rule:comments-indentation
7 changes: 5 additions & 2 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
name: gitleaks
on:

on: # yamllint disable-line rule:truthy
pull_request:
push:
workflow_dispatch:
Expand All @@ -16,4 +18,5 @@ jobs:
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.
# Only required for Organizations, not personal accosunts.
# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}}
38 changes: 20 additions & 18 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
---
name: Markdown Lint

on:
on: # yamllint disable-line rule:truthy
push:
branches: [ "main", "develop", "feature/*" ]
branches: ["main", "develop", "feature/*"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
os: ["ubuntu-latest"]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
# See supported Node.js release
# schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4

- name: Install dependencies
run: npm install -g markdownlint-cli
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Version
run: markdownlint --version
- name: Install dependencies
run: npm install -g markdownlint-cli

- name: Lint
run: markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.'
- name: Version
run: markdownlint --version

- name: Lint
run: >
markdownlint '**/*.md' --ignore node_modules
&& echo '✔ Your code looks good.'
95 changes: 50 additions & 45 deletions .github/workflows/python-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,67 @@
---
name: Python CI Coverage

on:
on: # yamllint disable-line rule:truthy
push:
branches: [ "main", "develop", "feature/*" ]
branches: ["main", "develop", "feature/*"]
pull_request:
branches: [ "main" ]
branches: ["main"]

env:
LOG_LEVEL: INFO

jobs:

build:
name: "Run CI"
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python: ['3.12']
python: ["3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python }}

- name: Install
run: |
pip3 install -r requirements.txt

- name: Test an coverage collect
run: |
python3 -m coverage run -m pytest --verbose -o log_cli=true --log-cli-level=INFO src/

- name: Coverage Report
run: |
python3 -m coverage report

- name: Coverage lcov
run: |
python3 -m coverage lcov -o coverage/lcov.info

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)

- name: Coverage XML
run: |
python3 -m coverage xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python }}

- name: Install
run: |
pip3 install -r requirements.txt

- name: Test an coverage collect
run: >
python3 -m coverage run -m pytest --verbose
-o log_cli=true
--log-cli-level=INFO
src/

- name: Coverage Report
run: |
python3 -m coverage report

- name: Coverage lcov
run: |
python3 -m coverage lcov -o coverage/lcov.info

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)

- name: Coverage XML
run: |
python3 -m coverage xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading