Skip to content

Commit

Permalink
[CONFIG] [FIX] yamllint warnings and errors fixed.
Browse files Browse the repository at this point in the history
False positive in "on:" adrienverge/yamllint#430 (comment)

Can't use "%YAML 1.2" directive because brakes Github Actions
  • Loading branch information
Gonzalo Diaz committed Jun 9, 2024
1 parent 4644678 commit 9b8f0e6
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 151 deletions.
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:
push:
branches: [ "main", "develop", "feature/*" ]
branches: ["main", "develop", "feature/*"]
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: "52 12 * * 1"

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

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
67 changes: 37 additions & 30 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:
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
8 changes: 6 additions & 2 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---

name: gitleaks

on:
pull_request:
push:
workflow_dispatch:
schedule:
- cron: "0 4 * * *" # run once a day at 4 AM
- cron: "0 4 * * *" # run once a day at 4 AM
jobs:
scan:
name: gitleaks
Expand All @@ -16,4 +19,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}}
37 changes: 20 additions & 17 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
---

name: Markdown Lint

on:
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.'
94 changes: 50 additions & 44 deletions .github/workflows/python-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,68 @@
---

name: Python CI Coverage

on:
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

0 comments on commit 9b8f0e6

Please sign in to comment.