Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .ebignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage
/test-results
/playwright-report

# next.js

/out/
.swc

# production
/build

# misc
.DS_Store
*.pem

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

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* @GaspardPierre
*.js @GaspardPierre
*.ts @GaspardPierre
*.tsx @GaspardPierre
/e2e/ @GaspardPierre
11 changes: 11 additions & 0 deletions .github/slack/test-failure-slack-payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🛑 *<https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}|${{ github.workflow }} workflow run>* failed."
}
}
]
}
13 changes: 13 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI
on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
run-tests:
uses: ./.github/workflows/test.yaml
secrets: inherit
70 changes: 70 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test
on:
workflow_call:

jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node Environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Check for Formatting Errors
run: npm run format
- name: Check for ESLint Errors
run: npm run lint
- name: Check for Type Errors
run: npm run typecheck
- name: Build Project
run: npm run build
- uses: actions/upload-artifact@v3
with:
name: build
path: .next/
- name: Run Unit Tests
run: npm run test
- uses: actions/upload-artifact@v3
if: always()
with:
name: coverage
path: coverage/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run E2E Tests
run: npm run test:e2e
env:
FLAGSMITH_KEY: ${{ secrets.FLAGSMITH_KEY }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
- name: Send a Slack Message on Failure
uses: slackapi/slack-github-action@v1.24.0
if: failure()
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🛑 *<https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}|${{ github.workflow }} workflow run>* failed."
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run start -- -p $PORT
12 changes: 12 additions & 0 deletions __tests__/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ import { render, screen } from "@testing-library/react";
import Home from "../src/app/page";
import "@testing-library/jest-dom";

jest.mock("../src/utils/flagsmith", () => {
return {
getEnvironmentFlags: jest.fn(() =>
Promise.resolve({
isFeatureEnabled: () => {
return true;
},
}),
),
};
});

describe("Home", () => {
it("renders a heading", () => {
render(<Home />);
Expand Down
Loading