Skip to content

Commit

Permalink
feat - Add initial project structure and configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco committed Dec 29, 2024
1 parent bea488b commit d776627
Show file tree
Hide file tree
Showing 26 changed files with 3,343 additions and 98 deletions.
16 changes: 16 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
LC_ALL=C

local_branch="$(git rev-parse --abbrev-ref HEAD)"

valid_branch_regex="^(penify|gitauto|dependabot|feature|fix|docs|style|refactor|perf|hotfix|test|chore|create)(\/[a-zA-Z0-9#._-]+)+$"

message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again."

if [[ ! $local_branch =~ $valid_branch_regex ]]
then
echo "$message"
exit 1
fi

npm run lint
39 changes: 39 additions & 0 deletions .githooks/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

# This script generates an AI-powered commit message using dotnet-aicommitmessage.
# It can be bypassed by setting the GIT_AICOMMIT_SKIP environment variable.

# Exit immediately if GIT_AICOMMIT_SKIP is set
if [ -n "$GIT_AICOMMIT_SKIP" ]; then
exit 0
fi

if ! command -v dotnet-aicommitmessage &> /dev/null; then
echo "Error: dotnet-aicommitmessage is not installed or not in PATH" >&2
echo "Please install it by running 'dotnet tool install -g aicommitmessage'" >&2
exit 1
fi

COMMIT_MSG_FILE=$1
CURRENT_MESSAGE=$(cat "$COMMIT_MSG_FILE")

# From version 0.6.1, this is not needed anymore.
# GIT_DIFF=$(git diff --staged)
# GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)

# Run dotnet-aicommitmessage with error handling
# From version 0.6.1 branch and diff are now retrieved by the tool and don't need to be passed manually.
# Version 0.6.1 and higher: dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE"
# Version 0.6.0 and lower: dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE" -b "$GIT_BRANCH_NAME" -d "$GIT_DIFF"

if ! AI_MESSAGE=$(dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE"); then
echo "Error: Failed to generate AI commit message. Using original message." >&2
exit 0
fi

if [[ -z "$AI_MESSAGE" || "$AI_MESSAGE" =~ ^[[:space:]]*$ ]]; then
echo "Error: Generated commit message is empty." >&2
exit 1
fi
echo "$AI_MESSAGE" > "$COMMIT_MSG_FILE"
exit 0
53 changes: 28 additions & 25 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
version: 2

updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 50
assignees:
- "guibranco"
reviewers:
- "guibranco"
labels:
- "npm"
- "dependencies"
groups:
react:
patterns:
- "react*"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 50
assignees:
- "guibranco"
reviewers:
- "guibranco"
labels:
- "npm"
- "dependencies"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 50
assignees:
- "guibranco"
reviewers:
- "guibranco"
labels:
- "github-actions"
- "dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 50
assignees:
- "guibranco"
reviewers:
- "guibranco"
labels:
- "github-actions"
- "dependencies"
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Test on Pull Request

on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm test
71 changes: 35 additions & 36 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build & Deploy via ftp

on:
push:
branches: [ main ]
branches: [main]
workflow_dispatch:

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

Expand All @@ -17,54 +17,53 @@ jobs:
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}

steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "6.0.x"

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: npm install
- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
- name: Build
run: npm run build

- name: Test
run: npm test
- name: Test
run: npm test

- name: Upload build
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: "build/"
remoteDir: "/public_html/ui/sports-agenda/"
options: "--delete"
- name: Upload build
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: "dist/"
remoteDir: "/public_html/ui/sports-agenda/"
options: "--delete"

create_release:
name: Create release
needs: build
runs-on: ubuntu-latest
env:
fullSemVer: ${{ needs.build.outputs.fullSemVer }}

steps:
- name: Create Release
uses: ncipollo/[email protected]
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/infisical-secrets-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ concurrency:
cancel-in-progress: true

jobs:

secrets-scan:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:

- name: Checkout repo
uses: actions/checkout@v4
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/size-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: size-label
if: >-
(
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/snorkell-auto-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
Documentation:
runs-on: ubuntu-latest
steps:
- name: Penify DocGen Client
uses: SingularityX-ai/[email protected]
with:
client_id: ${{ secrets.SNORKELL_CLIENT_ID }}
api_key: ${{ secrets.SNORKELL_API_KEY }}
branch_name: "main"
- name: Penify DocGen Client
uses: SingularityX-ai/[email protected]
with:
client_id: ${{ secrets.SNORKELL_CLIENT_ID }}
api_key: ${{ secrets.SNORKELL_API_KEY }}
branch_name: "main"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
types: [opened, synchronize, reopened]

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

Expand All @@ -15,21 +15,23 @@ jobs:
name: SonarCloud
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install dependencies
run: npm install

- name: Test and coverage
run: npm run test -- --coverage --watchAll=false
run: npm run test:coverage

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: >-
(
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
) || (
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
) || (
Expand Down
41 changes: 21 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Loading

0 comments on commit d776627

Please sign in to comment.