Skip to content

Commit

Permalink
Merge pull request #29 from bouvet/feat/#12/Configure-pipelines
Browse files Browse the repository at this point in the history
Feat/#12/configure pipelines
  • Loading branch information
TLoug authored Oct 16, 2024
2 parents ac3a06b + d836063 commit e5c60cf
Show file tree
Hide file tree
Showing 24 changed files with 10,091 additions and 5,006 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
versioning-strategy: increase
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Description

<!-- Please include a summary of the changes. -->

## Testing Done

<!-- Describe the tests you have conducted to verify your changes. -->

## Type of change

- [ ] Bug fix (non-breaking change that resolves an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to break)
- [ ] Documentation update required for this change

## Checklist:

- [ ] My code adheres to the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have added comments to my code, especially in complex areas
- [ ] I have updated the documentation accordingly
- [ ] My changes do not introduce any new warnings
- [ ] I have added tests to validate the effectiveness of my fix or the functionality of my feature
- [ ] Both new and existing unit tests pass locally with my changes
- [ ] I have considered and addressed any potential security implications
101 changes: 101 additions & 0 deletions .github/workflows/pullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Pull request

# Controls when the action will run.
on:
pull_request:

# Global environment variables
# env:
# CI: true

# Jobs
jobs:
# # Validate PR title
# !todo discuss this job step is this overkill?
# validate_pr_title:
# runs-on: ubuntu-latest
# steps:
# - uses: amannn/action-semantic-pull-request@v5
# id: lint_pr_title
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - uses: marocchino/sticky-pull-request-comment@v2
# if: always() && (steps.lint_pr_title.outputs.error_message != null)
# with:
# header: pr-title-lint-error
# message: |
# Hey there and thank you for opening this pull request! 👋🏼

# We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.

# Details:

# ```
# ${{ steps.lint_pr_title.outputs.error_message }}
# ```
# - if: ${{ steps.lint_pr_title.outputs.error_message == null }}
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# header: pr-title-lint-error
# delete: true

# Set up tests
set_up:
name: Set up
runs-on: ubuntu-latest
# needs: [validate_pr_title]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
cache-dependency-path: ${{github.workspace}}/frontend/package-lock.json
- run: yarn install --immutable

# Lint job
lint:
name: Lint
runs-on: ubuntu-latest
needs: [set_up]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ${{github.workspace}}/frontend/package-lock.json

- name: Install packages
working-directory: ./frontend
run: yarn install

- name: Run lint
working-directory: ./frontend
run: yarn lint

# Tests
tests:
name: Tests
runs-on: ubuntu-latest
needs: [set_up]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
cache-dependency-path: ${{github.workspace}}/frontend/package-lock.json
- name: Install packages
working-directory: ./frontend
run: yarn install
- name: Run tests
working-directory: ./frontend
run: yarn test
2 changes: 2 additions & 0 deletions .husky/_/applypatch-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
20 changes: 20 additions & 0 deletions .husky/_/h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh
[ "$HUSKY" = "2" ] && set -x
h="${0##*/}"
s="${0%/*/*}/$h"

[ ! -f "$s" ] && exit 0

for f in "${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh" "$HOME/.huskyrc"; do
# shellcheck disable=SC1090
[ -f "$f" ] && . "$f"
done

[ "${HUSKY-}" = "0" ] && exit 0

sh -e "$s" "$@"
c=$?

[ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit $c
2 changes: 2 additions & 0 deletions .husky/_/post-applypatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/post-rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-applypatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-auto-gc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-rebase
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
2 changes: 2 additions & 0 deletions .husky/_/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "${0%/*}/h"
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
. "$(dirname -- "$0")/common.sh"

yarn commitlint --edit $1
8 changes: 8 additions & 0 deletions .husky/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Workaround for Windows 10, Git Bash, and Yarn
if command_exists winpty && test -t 1; then
exec < /dev/tty
fi
13 changes: 13 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function changed {
git diff --name-only HEAD@{1} HEAD | grep "^$1" >/dev/null 2>&1
}

echo 'Checking for changes in yarn.lock...'

if changed 'yarn.lock'; then
echo "📦 yarn.lock changed. Run yarn install to bring your dependencies up to date."
yarn install
fi

echo 'You are up to date :)'
exit 0
18 changes: 18 additions & 0 deletions frontend/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from 'jest'
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})

// Add any custom config to be passed to Jest
const config: Config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config)
Loading

0 comments on commit e5c60cf

Please sign in to comment.