Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: playwright, vitest #2

Merged
merged 11 commits into from
Apr 2, 2024
Merged
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
26 changes: 0 additions & 26 deletions .github/workflows/build.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 🔎 CodeQL

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "16 1 * * 5"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Deploy demo
name: 🌍 Deploy demo

on:
push:
branches: [main, next]
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
cancel-in-progress: true
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/e2e.yml

This file was deleted.

13 changes: 9 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Lint
name: ⛑️ Lint

on: [pull_request, push]
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
cancel-in-progress: true
Expand Down Expand Up @@ -32,6 +36,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v2.1.0
uses: hadolint/hadolint-action@v3.1.0
with:
recursive: true
dockerfile: Dockerfile
verbose: true
34 changes: 34 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🤖 Playwright Tests

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
test:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install -g yarn && yarn
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Build app
run: yarn build
env:
NEXT_PUBLIC_BASE_PATH: ""
NODE_ENV: production
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: 📦 Release

on:
workflow_dispatch:
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Testing
name: 💪 Testing

on: [pull_request, push]
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
cancel-in-progress: true
Expand All @@ -16,11 +20,14 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "18"
cache: "yarn"
- name: Install dependencies
run: |
yarn --immutable
- name: Build code
run: |
yarn build
- name: Test code
run: |
yarn test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ robots.txt
!.yarn/versions

# storybook
/.out
/.out
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
18
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fileignoreconfig:
- filename: .yarn/**
checksum: any
- filename: Dockerfile
checksum: 9605a14ae835a4263de3badf041bfbde2823f2d9f2342e09c369ec9c7ae8615f
checksum: 31aa8689fb079f89949f8c4e5a917b040176f8a5b8492ba0a5252ad5e1bba049
- filename: README.md
checksum: 7c55475ff28dbfa46c9c5715918add6a0202eafddca3cf9d35ebcdd443d76ffd
- filename: pages/mui.tsx
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG NODE_VERSION=20-alpine3.18@sha256:5ff63217ec2757b29a4414e0f787bfc13c1f9cb6f053e46ff05c1a51bbd2e8e6
ARG NODE_VERSION=20-alpine3.19@sha256:ef3f47741e161900ddd07addcaca7e76534a9205e4cd73b2ed091ba339004a75

# Install dependencies only when needed
FROM node:$NODE_VERSION AS builder
RUN apk add --no-cache libc6-compat=1.2.4-r2
# hadolint ignore=DL3018
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY yarn.lock package.json ./
Expand All @@ -17,14 +18,16 @@ ARG NEXT_PUBLIC_SITE_URL
ENV NEXT_PUBLIC_SITE_URL $NEXT_PUBLIC_SITE_URL

ENV NODE_ENV production
ENV NEXT_PUBLIC_BASE_PATH ""

WORKDIR /app

RUN yarn postinstall # if you have postinstall script in your package.json
RUN if [ -z "$PRODUCTION" ]; then \
echo "Overriding .env for staging"; \
cp .env.staging .env.production; \
fi && \
yarn build:export
yarn build

# Production image, copy all the files and run nginx
FROM ghcr.io/socialgouv/docker/nginx:sha-1d70757 AS runner
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ yarn # to install dependencies
yarn dev # to run in dev mode
```

Point your browser to [http://127.0.0.1:3000/template](http://127.0.0.1:3000/template) and start playing.

### Tests

```
# run unit tests with vitest
yarn test

# build, serve and launch playwright interactive end-to-end tests
yarn e2e --ui

# run storybook
yarn storybook
```

### Gestion des environnements

Les variables issues des docker build-args, sont à utiliser dans `next.config.js`, pour les autres, il faut les définir dans les différents [`.env.*`](https://nextjs.org/docs/basic-features/environment-variables#environment-variable-load-order).
Expand All @@ -41,3 +56,7 @@ Le fichier `.env.development` est utilisé pour l'environnement de développemen
| [codegouvfr/docsify-dsfr-template](https://github.com/codegouvfr/docsify-dsfr-template) | Template DSFR pour [docsify](https://docsify.js.org/#/) |
| [sneko/dsfr-connect](https://github.com/sneko/dsfr-connect) | Themes DSFR pour bootstrap, vuetify, mui, infima, emails... |
| [socialgouv/template](https://github.com/socialgouv/template) | Version initiale de ce template |

```

```
5 changes: 0 additions & 5 deletions cypress.json

This file was deleted.

5 changes: 0 additions & 5 deletions cypress/fixtures/example.json

This file was deleted.

7 changes: 0 additions & 7 deletions cypress/integration/accessibilite.spec.ts

This file was deleted.

7 changes: 0 additions & 7 deletions cypress/integration/cgu.spec.ts

This file was deleted.

6 changes: 0 additions & 6 deletions cypress/integration/healthz.spec.ts

This file was deleted.

7 changes: 0 additions & 7 deletions cypress/integration/home.spec.ts

This file was deleted.

7 changes: 0 additions & 7 deletions cypress/integration/mentions-legales.spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions cypress/integration/politique-confidentialite.spec.ts

This file was deleted.

6 changes: 0 additions & 6 deletions cypress/integration/stats.spec.ts

This file was deleted.

22 changes: 0 additions & 22 deletions cypress/plugins/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions cypress/support/commands.ts

This file was deleted.

20 changes: 0 additions & 20 deletions cypress/support/index.ts

This file was deleted.

Loading
Loading