diff --git a/.commitlintrc.yaml b/.commitlintrc.yaml new file mode 100644 index 0000000..22cacc1 --- /dev/null +++ b/.commitlintrc.yaml @@ -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 diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index 989dcce..8c5a3b0 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -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 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..aa7b66b --- /dev/null +++ b/.github/workflows/lint.yaml @@ -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/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5e9b736 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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: + - eslint@9.6.0 + - '@eslint/js@9.6.0' + - 'typescript-eslint@7.15.0' + - 'angular-eslint@18.1.0' + - eslint-config-prettier@9.1.0 + files: \.(ts|html)$ + types: [file] diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..810f444 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "tabWidth": 4, + "arrowParens": "always", + "quoteProps": "consistent", + "printWidth": 120 +}