Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sneko committed Jan 14, 2025
2 parents 905c77d + be69c47 commit 5a877f3
Show file tree
Hide file tree
Showing 348 changed files with 88,592 additions and 2 deletions.
1 change: 1 addition & 0 deletions .buildpacks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/Scalingo/nodejs-buildpack
4 changes: 4 additions & 0 deletions .ci.env.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CHROMATIC_PROJECT_TOKEN=
SENTRY_URL=
SENTRY_AUTH_TOKEN=
SENTRY_RELEASE_UPLOAD=true
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .env.jest.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TEST_BILLETWEB_ACCESS_KEY=
TEST_BILLETWEB_SECRET_KEY=
22 changes: 22 additions & 0 deletions .env.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PORT=3000
APP_BASE_URL=
DATABASE_URL=
MAINTENANCE_API_KEY=
NEXT_AUTH_SECRET=
CRISP_SIGNING_SECRET_KEY=
NEXT_PUBLIC_CRISP_WEBSITE_ID=
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_MATOMO_URL=
NEXT_PUBLIC_MATOMO_SITE_ID=
MAILER_DEFAULT_DOMAIN=
MAILER_DOMAINS_TO_CATCH=
MAILER_SMTP_HOST=
MAILER_SMTP_PORT=
MAILER_SMTP_USER=
MAILER_SMTP_PASSWORD=
MAILER_FALLBACK_SMTP_HOST=
MAILER_FALLBACK_SMTP_PORT=
MAILER_FALLBACK_SMTP_USER=
MAILER_FALLBACK_SMTP_PASSWORD=
DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS=
SENTRY_IGNORE_API_RESOLUTION_ERROR=1
21 changes: 21 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PORT=3000
DATABASE_URL=postgresql://postgres:changeme@localhost:5432/postgres
MAINTENANCE_API_KEY=random
NEXT_AUTH_SECRET=seed-to-forge-jwt-tokens-not-sensitive-in-temporary-environments
CRISP_SIGNING_SECRET_KEY=seed-to-sign-emails-cannot-work-without-a-remote-crisp-account
NEXT_PUBLIC_CRISP_WEBSITE_ID=random-one-since-cannot-work-without-a-remote-crisp-account
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_MATOMO_URL=
NEXT_PUBLIC_MATOMO_SITE_ID=
MAILER_DEFAULT_DOMAIN=assistant-declaration.local.fr
MAILER_DOMAINS_TO_CATCH=domain.demo
MAILER_SMTP_HOST=127.0.0.1
MAILER_SMTP_PORT=11025
MAILER_SMTP_USER=random
MAILER_SMTP_PASSWORD=random
MAILER_FALLBACK_SMTP_HOST=127.0.0.1
MAILER_FALLBACK_SMTP_PORT=11025
MAILER_FALLBACK_SMTP_USER=random
MAILER_FALLBACK_SMTP_PASSWORD=random
DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS=00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000003
SENTRY_IGNORE_API_RESOLUTION_ERROR=1
38 changes: 38 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
root: true,
extends: ['next', 'prettier', 'plugin:storybook/recommended', 'plugin:jsx-a11y/strict'],
plugins: ['@typescript-eslint', 'import', 'jsx-a11y', 'testing-library'],
ignorePatterns: ['build', 'data', 'dist', 'storybook-static'],
rules: {
'@next/next/no-html-link-for-pages': 'off',
'interface-name': 'off',
'no-console': 'off',
'no-implicit-dependencies': 'off',
'no-submodule-imports': 'off',
'no-trailing-spaces': 'error',
'react/jsx-key': 'off',
// When hunting dead code it's useful to use the following:
// ---
// 'no-unused-vars': 'error',
// 'import/no-unused-modules': [1, { unusedExports: true }],
},
overrides: [
{
files: ['*.md', '*.mdx'],
extends: 'plugin:mdx/recommended',
parserOptions: {
// The version needs to be "fixed" due to linting errors otherwise (ref: https://github.com/mdx-js/eslint-mdx/issues/366#issuecomment-1361898854)
ecmaVersion: 12,
},
rules: {
// Inside .mdx files it always throws this rule when there is a title tag, no matter what, so skipping
'jsx-a11y/heading-has-content': 'off',
},
},
// Only uses Testing Library lint rules in test files
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
},
],
};
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set default behavior to automatically normalize line endings.
* text=auto

# Don't allow people to merge changes to these generated files, because the result may be invalid
package-lock.json merge=binary

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: '🐛 Bug Report'
about: Report a reproducible bug or regression.
title: ''
labels: bug
assignees: ''
---

## Current Behavior

<!-- Describe how the issue manifests. -->

## Expected Behavior

<!-- Describe what the desired behavior would be. -->

## Steps to Reproduce the Problem

1.
2.
3.

## Environment

- Version: <!-- Release version available on the GitHub repository home -->
- Platform: <!-- Windows/Mac/Linux -->
- Node.js Version: <!-- Output of running `node -v` -->
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: 🌈 Feature request
about: Suggest an amazing new idea for this project
title: ''
labels: enhancement
assignees: ''
---

## Feature Request

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. Ex. I have an issue when [...] -->

**Describe the solution you'd like**

<!-- A clear and concise description of what you want to happen. Add any considered drawbacks. -->

**Describe alternatives you've considered**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Are you willing to resolve this issue by submitting a Pull Request?

<!--
Remember that first-time contributors are welcome! 🙌
-->

- [ ] Yes, I have the time, and I know how to start.
- [ ] Yes, I have the time, but I don't know how to start. I would need guidance.
- [ ] No, I don't have the time, although I believe I could do it if I had the time...
- [ ] No, I don't have the time and I wouldn't even know how to start.

<!--
👋 Have a great day and thank you for the feature request!
-->
42 changes: 42 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
😀 Wonderful! Thank you for opening a pull request.
Please fill in the information below to expedite the review
and (hopefully) merge of your change.
-->

### Description of change

<!--
Please be clear and concise what the change is intended to do,
why this change is needed, and how you've verified that it
corrects what you intended.
In some cases it may be helpful to include the current behavior
and the new behavior.
If the change is related to an open issue, you can link it here.
If you include `Fixes #0000` (replacing `0000` with the issue number)
when this is merged it will automatically mark the issue as fixed and
close it.
-->

### Pull-Request Checklist

<!--
Please make sure to review and check all of the following.
If an item is not applicable, you can add "N/A" to the end.
-->

- [ ] Code is up-to-date with the `main` branch
- [ ] `npm run lint` passes with this change
- [ ] `npm run test` passes with this change
- [ ] This pull request links relevant issues as `Fixes #0000`
- [ ] There are new or updated unit tests validating the change
- [ ] Documentation has been updated to reflect this change
- [ ] The new commits follow conventions outlined in the [conventional commit spec](https://www.conventionalcommits.org/en/v1.0.0/)

<!--
🎉 Thank you for contributing!
-->
Empty file added .github/act/.env
Empty file.
3 changes: 3 additions & 0 deletions .github/act/event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"act": true
}
124 changes: 124 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Continuous Integration
on:
push:
branches:
- main
- dev
pull_request:
env:
APP_NAME: assistant-declaration
NODE_OPTIONS: --max_old_space_size=4096
NODE_VERSION: 20.15.0
JEST_CACHE_FOLDER_SUFFIX: .cache/jest
PLAYWRIGHT_BROWSERS_CACHE_FOLDER_SUFFIX: .cache/ms-playwright
concurrency:
# Prevent parallel builds of the same branch
group: cicd-${{ github.ref }}
cancel-in-progress: false
jobs:
requirements:
name: Continuous Integration
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set environment for branch
run: |
if [[ $GITHUB_REF_NAME == 'main' ]]; then
echo "APP_MODE=prod" >> $GITHUB_ENV
elif [[ $GITHUB_REF_NAME == 'dev' ]]; then
echo "APP_MODE=dev" >> $GITHUB_ENV
else
echo "APP_MODE=test" >> $GITHUB_ENV
fi
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Export npm store directory as an environment variable
shell: bash
run: |
echo "STORE_PATH=$(npm config get cache)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup npm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-npm-store-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-store-
- uses: actions/cache@v3
name: Setup Next.js build cache
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ env.STORE_PATH }}/${{ env.PLAYWRIGHT_BROWSERS_CACHE_FOLDER_SUFFIX }}
run: npm install

- name: Prepare linting
run: npm run lint:prepare

- name: Lint
run: npm run lint

- name: Format check
run: npm run format:check

- name: Prepare tests
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ env.STORE_PATH }}/${{ env.PLAYWRIGHT_BROWSERS_CACHE_FOLDER_SUFFIX }}
run: npm run test:prepare

- name: Install `docker-compose` for local CI/CD simulations (https://github.com/nektos/act/issues/112#issuecomment-1387307297)
if: ${{ env.ACT }}
uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: '2.14.2'
- name: Install `Xvfb` and others to run browsers for end-to-end testing in local CI/CD simulations (https://github.com/nektos/act/issues/1300#issuecomment-1387344639)
if: ${{ env.ACT }}
run: sudo apt-get update && sudo apt-get install -y xvfb && npm run playwright install-deps chromium

- name: Get number of CPU cores for the following test step
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

- name: Test unit
env:
JEST_CACHE_PATH: ${{ env.STORE_PATH }}/${{ env.JEST_CACHE_FOLDER_SUFFIX }}
run: npm run test:unit --- --max-workers ${{ steps.cpu-cores.outputs.count }}

- name: Build
env:
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_RELEASE_UPLOAD: true
run: npm run build

- name: Test end-to-end
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ env.STORE_PATH }}/${{ env.PLAYWRIGHT_BROWSERS_CACHE_FOLDER_SUFFIX }}
JEST_MAX_WORKERS: ${{ steps.cpu-cores.outputs.count }}
run: npm run test:e2e:headless

- name: Publish to Chromatic
if: ${{ !github.event.act }}
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
run: npm run chromatic

# Since using Scalingo as runtime provider, from here GitHub will trigger a webhook to Scalingo
# so the latter will perform a quick local build to deploy the application on the right environment
# It's a bit of duplication but Scalingo does not allow bypassing their logic
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# tools settings folders
/**/.*/**/*
!.github/**/*
!.vscode/extensions.json
!.vscode/i18n-ally-reviews.yml
!.vscode/launch.json
!.vscode/settings.json

# dependencies
node_modules

# next.js
.next/
out/
build/
dist/

# sentry
/.sentryclirc
/sentry.properties

# storybook
!/.storybook/**/*
/storybook-static/
/build-storybook.log

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# data
/public/assets/fonts/

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.jest.local

# legal documents to transform to HTML (with `format-legal-documents.sh`)
/src/**/*.docx
Loading

0 comments on commit 5a877f3

Please sign in to comment.