parent
d555f34cd3
commit
6efff15731
|
@ -4,7 +4,6 @@ on:
|
|||
types: [opened, synchronize]
|
||||
push:
|
||||
branches: [master, demo, next]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
|
@ -19,31 +18,27 @@ jobs:
|
|||
- if: github.event_name == 'pull_request'
|
||||
name: 'Set site name for pull request deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
echo "FR_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=deploy-preview-${{ github.event.number }}--syso.netlify.app\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
- if: github.event_name == 'push' && github.ref != 'refs/heads/master'
|
||||
name: 'Set site name for named branch deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr/\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr/\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
echo "FR_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
- if: github.ref == 'refs/heads/master'
|
||||
name: 'Set site name for production deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://mon-entreprise.fr/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://mycompanyinfrance.fr/\${path}" >> $GITHUB_ENV
|
||||
echo "PUBLICODES_SITE=https://publi.codes/\${path}" >> $GITHUB_ENV
|
||||
|
||||
echo "FR_SITE=https://mon-entreprise.fr\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://mycompanyinfrance.fr\${path}" >> $GITHUB_ENV
|
||||
echo "PUBLICODES_SITE=https://publi.codes\${path}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12'
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
|
||||
- run: yarn install
|
||||
- run: yarn install --frozen-lockfile
|
||||
env:
|
||||
# Secrets of all kinds for fetching stats & releases
|
||||
GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -65,21 +60,26 @@ jobs:
|
|||
production-branch: master
|
||||
production-deploy: ${{ github.ref == 'refs/heads/master' }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
enable-commit-status: true
|
||||
enable-commit-comment: false
|
||||
github-deployment-environment: $ENV_NAME
|
||||
alias: $ENV_NAME
|
||||
deploy-message: ${{ github.event.pull_request.title || steps.vars.outputs.branch}}
|
||||
|
||||
# Disabled because we create our own customized comment
|
||||
enable-pull-request-comment: false
|
||||
alias: ${{ github.event_name == 'push' && steps.vars.outputs.branch || format('deploy-preview-{0}', github.event.number) }}
|
||||
env:
|
||||
ENV_NAME: ${{ github.event_name == 'push' && steps.vars.outputs.branch || format('deploy-preview-{0}', github.event.number) }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
||||
|
||||
post-comment:
|
||||
runs-on: ubuntu-18.04
|
||||
if: github.event_name == 'pull_request'
|
||||
needs: build
|
||||
steps:
|
||||
- name: Find Comment
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: peter-evans/find-comment@v1
|
||||
id: find-comment
|
||||
with:
|
||||
|
@ -99,16 +99,17 @@ jobs:
|
|||
end-to-end-test:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CYPRESS_RECORD_KEY: 21660df5-36a5-4c49-b23d-801799b0c759 #TODO put in secrets
|
||||
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
runs-on: ubuntu-16.04
|
||||
needs: build
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
lang: ['fr', 'en']
|
||||
browser: ['firefox', 'chrome']
|
||||
containers: [1, 2]
|
||||
# TODO : activate parallelization https://github.com/cypress-io/github-action#parallel (missing https://github.com/cypress-io/github-action#custom-build-id)
|
||||
# fail-fast: false
|
||||
# containers: [1, 2]
|
||||
# TODO : browser: ['firefox', 'chrome']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
@ -116,21 +117,17 @@ jobs:
|
|||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
working-directory: mon-entreprise
|
||||
browser: ${{ matrix.browser }}
|
||||
record: true
|
||||
parallel: true
|
||||
group: 'mon-entreprise'
|
||||
tag: mon-entreprise-${{ matrix.browser }}-${{ matrix.lang }}
|
||||
tag: mon-entreprise-${{ matrix.lang }}
|
||||
config: integrationFolder=cypress/integration/mon-entreprise
|
||||
env: site=${{ needs.build.outputs[matrix.lang] }},language=${{ matrix.lang }}
|
||||
|
||||
|
||||
- name: Test publicodes
|
||||
if: matrix.lang == 'fr'
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
browser: ${{ matrix.browser }}
|
||||
record: true
|
||||
tag: publicodes-${{ matrix.browser }}
|
||||
tag: publicodes
|
||||
config: integrationFolder=cypress/integration/publi.codes
|
||||
env: site=${{ needs.build.outputs.publicodes }}
|
||||
|
||||
|
@ -138,8 +135,8 @@ jobs:
|
|||
if: matrix.lang == 'fr' && github.ref == 'refs/heads/master'
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
browser: ${{ matrix.browser }}
|
||||
browser: chrome
|
||||
record: true
|
||||
tag: external-integration-${{ matrix.browser }}
|
||||
tag: external-integration
|
||||
config: integrationFolder=cypress/integration/external
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
name: Règles (non-regression)
|
||||
on: pull_request
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn test:regressions
|
|
@ -0,0 +1,58 @@
|
|||
name: Tests
|
||||
on: push
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn lint
|
||||
|
||||
typecheck:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
|
||||
- run: yarn install --frozen-lockfile
|
||||
env:
|
||||
# Secrets of all kinds for fetching stats & releases
|
||||
GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }}
|
||||
ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }}
|
||||
ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }}
|
||||
ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }}
|
||||
- run: yarn test:type
|
||||
|
||||
unit:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn test
|
||||
|
||||
i18n:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
|
||||
- run: yarn install --frozen-lockfile
|
||||
- working-directory: mon-entreprise
|
||||
run:
|
||||
yarn run i18n:rules:check;
|
||||
yarn run i18n:ui:check
|
||||
|
||||
|
||||
|
125
circle.yml
125
circle.yml
|
@ -1,125 +0,0 @@
|
|||
version: 2.1
|
||||
commands:
|
||||
install:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||
- v1-deps-{{ .Branch }}
|
||||
- v1-deps
|
||||
- run: yarn install --frozen-lockfile
|
||||
- save_cache:
|
||||
key: v1-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ~/.cache
|
||||
cypress:
|
||||
parameters:
|
||||
language:
|
||||
type: enum
|
||||
enum: [fr, en]
|
||||
default: fr
|
||||
integration_folder:
|
||||
type: enum
|
||||
enum: [mon-entreprise, external, publi.codes]
|
||||
default: mon-entreprise
|
||||
base_url:
|
||||
type: string
|
||||
default: https://mon-entreprise.fr
|
||||
steps:
|
||||
- run: |
|
||||
cd mon-entreprise
|
||||
CYPRESS_baseUrl=<< parameters.base_url >> yarn run cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759 --env language=<< parameters.language >> --config integrationFolder=cypress/integration/<< parameters.integration_folder >>
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
docker:
|
||||
- image: node:12.16.1-buster
|
||||
steps:
|
||||
- install
|
||||
- run: |
|
||||
yarn lint:eslintrc
|
||||
yarn lint:eslint --quiet
|
||||
yarn lint:prettier
|
||||
type-check:
|
||||
docker:
|
||||
- image: node:12.16.1-buster
|
||||
steps:
|
||||
- install
|
||||
- run: yarn test:type
|
||||
i18n-check:
|
||||
docker:
|
||||
- image: node:12.16.1-buster
|
||||
steps:
|
||||
- install
|
||||
- run: |
|
||||
cd mon-entreprise
|
||||
yarn run i18n:rules:check
|
||||
yarn run i18n:ui:check
|
||||
|
||||
unit-test:
|
||||
docker:
|
||||
- image: node:12.16.1-buster
|
||||
steps:
|
||||
- install
|
||||
- run: git config --global core.quotepath false
|
||||
- run: yarn test
|
||||
- run: yarn test:regressions
|
||||
|
||||
end-to-end-test:
|
||||
docker:
|
||||
- image: cypress/base:12.16.1
|
||||
environment:
|
||||
TERM: xterm
|
||||
steps:
|
||||
- install
|
||||
- run: export NODE_OPTIONS="--max-old-space-size=4096" && yarn workspace mon-entreprise build:dev
|
||||
- run:
|
||||
command: yarn workspace mon-entreprise serve:dev
|
||||
background: true
|
||||
- cypress:
|
||||
base_url: http://localhost:5000
|
||||
- cypress:
|
||||
base_url: http://localhost:5001
|
||||
language: en
|
||||
- cypress:
|
||||
base_url: http://localhost:5002
|
||||
integration_folder: publi.codes
|
||||
|
||||
production-end-to-end-test:
|
||||
docker:
|
||||
- image: cypress/base:12.16.1
|
||||
environment:
|
||||
TERM: xterm
|
||||
parallelism: 3
|
||||
steps:
|
||||
- install
|
||||
- cypress:
|
||||
base_url: https://mon-entreprise.fr
|
||||
- cypress:
|
||||
base_url: https://mycompanyinfrance.fr
|
||||
language: en
|
||||
- cypress:
|
||||
integration_folder: external
|
||||
- cypress:
|
||||
base_url: https://publi.codes
|
||||
integration_folder: publi.codes
|
||||
- run:
|
||||
name: Send email if test failed
|
||||
when: on_fail
|
||||
command: >
|
||||
curl -H 'Content-Type: application/json' --request POST -d '{"success": false}' https://hooks.zapier.com/hooks/catch/3746650/qsp818/;
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
test:
|
||||
jobs:
|
||||
- lint
|
||||
- type-check
|
||||
- i18n-check
|
||||
- unit-test
|
||||
- end-to-end-test
|
||||
- production-end-to-end-test:
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"projectId": "jxcngh",
|
||||
"baseUrl": "http://localhost:8080/mon-entreprise",
|
||||
"env": {
|
||||
"site": "http://localhost:8080/mon-entreprise/${path}",
|
||||
"language": "fr"
|
||||
},
|
||||
"integrationFolder": "cypress/integration/mon-entreprise",
|
||||
|
|
|
@ -250,21 +250,33 @@ async function fetchUserFeedbackIssues() {
|
|||
}
|
||||
async function main() {
|
||||
createDataDir()
|
||||
try {
|
||||
const visitesJours = await fetchDailyVisits()
|
||||
const visitesMois = await fetchMonthlyVisits()
|
||||
const satisfaction = uniformiseData(
|
||||
flattenPage(await fetchApi(buildSatisfactionQuery()))
|
||||
)
|
||||
const retoursUtilisateurs = await fetchUserFeedbackIssues()
|
||||
writeInDataDir('stats.json', {
|
||||
visitesJours,
|
||||
visitesMois,
|
||||
satisfaction,
|
||||
retoursUtilisateurs,
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
||||
const visitesJours = await fetchDailyVisits()
|
||||
const visitesMois = await fetchMonthlyVisits()
|
||||
const satisfaction = uniformiseData(
|
||||
flattenPage(await fetchApi(buildSatisfactionQuery()))
|
||||
)
|
||||
const retoursUtilisateurs = await fetchUserFeedbackIssues()
|
||||
writeInDataDir('stats.json', {
|
||||
visitesJours,
|
||||
visitesMois,
|
||||
satisfaction,
|
||||
retoursUtilisateurs,
|
||||
})
|
||||
// In case we cannot fetch the release (the API is down or the Authorization
|
||||
// token isn't valid) we fallback to some fake data -- it would be better to
|
||||
// have a static ressource accessible without authentification.
|
||||
writeInDataDir('stats.json', {
|
||||
visitesJours: [],
|
||||
visitesMois: [],
|
||||
satisfaction: [],
|
||||
retoursUtilisateurs: [],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
throw new Error(e)
|
||||
})
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { ThemeColorsContext } from 'Components/utils/colors'
|
||||
import { formatValue } from 'publicodes'
|
||||
import { groupWith } from 'ramda'
|
||||
import React, { Fragment, useContext } from 'react'
|
||||
import {
|
||||
Area,
|
||||
|
@ -15,7 +14,6 @@ import {
|
|||
XAxis,
|
||||
YAxis,
|
||||
} from 'recharts'
|
||||
import stats from '../../data/stats.json'
|
||||
|
||||
type Period = 'mois' | 'jours'
|
||||
|
||||
|
@ -23,18 +21,6 @@ type Data =
|
|||
| Array<{ date: string; nombre: number }>
|
||||
| Array<{ date: string; nombre: Record<string, number> }>
|
||||
|
||||
const weekEndDays = groupWith(
|
||||
(a, b) => {
|
||||
const dayAfterA = new Date(a)
|
||||
dayAfterA.setDate(dayAfterA.getDate() + 1)
|
||||
return dayAfterA.toISOString().substring(0, 10) === b
|
||||
},
|
||||
stats.visitesJours.site
|
||||
.map(({ date }) => new Date(date))
|
||||
.filter((date) => date.getDay() === 0 || date.getDay() === 6)
|
||||
.map((date) => date.toISOString().substring(0, 10))
|
||||
)
|
||||
|
||||
type VisitsChartProps = {
|
||||
period: Period
|
||||
sync?: boolean
|
||||
|
|
Loading…
Reference in New Issue