Skip to content

Commit

Permalink
Merge pull request #3 from Accenture/ci/add-code-quality-tooling
Browse files Browse the repository at this point in the history
Ci/add code quality tooling
  • Loading branch information
ChristophBe authored Oct 18, 2024
2 parents 563b549 + d3d3cf7 commit 3c8cfc6
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 36 deletions.
26 changes: 26 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
extends:
- '@commitlint/config-conventional'
rules:
# Scope enum should be customized to match project needs
scope-enum:
- 2
- always
- ['deps']
# Type enum should be consistent across data science projects
type-enum:
- 2
- always
- - build
- chore
- ci
- docs
- feat
- fix
- perf
- refactor
- revert
- style
- test
- data
- explore
- result
77 changes: 41 additions & 36 deletions .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
name: Create and publish a Docker image
name: Build

on:
push:
branches: ['main']
workflow_run:
workflows:
- Linting
types:
- completed
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: accenture/federated-catalogue-viewer
REGISTRY: ghcr.io
IMAGE_NAME: accenture/federated-catalogue-viewer

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
20 changes: 20 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Linting
on:
push:

env:
PYTHON_VERSION: 3.12
NODE_VERSION: 18.12

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- uses: pre-commit/[email protected]
47 changes: 47 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [commit, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
args:
- '--maxkb=10000'
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-xml
- id: check-case-conflict
- id: check-symlinks
- id: check-merge-conflict
stages:
- commit
- merge-commit
- manual
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.16.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
stages:
- commit-msg
- repo: https://github.com/prettier/pre-commit
rev: v2.1.2
hooks:
- id: prettier
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v9.6.0'
hooks:
- id: eslint
args:
- '--fix'
- '--config'
- 'eslint.config.js'
additional_dependencies:
- [email protected]
- '@eslint/[email protected]'
- '[email protected]'
- '[email protected]'
- [email protected]
files: \.(ts|html)$
types: [file]
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4,
"arrowParens": "always",
"quoteProps": "consistent",
"printWidth": 120
}

0 comments on commit 3c8cfc6

Please sign in to comment.