diff --git a/.github/workflows/previewDeploy.yml b/.github/workflows/previewDeploy.yml index bc243ce3d1..f8884eb2d6 100644 --- a/.github/workflows/previewDeploy.yml +++ b/.github/workflows/previewDeploy.yml @@ -48,6 +48,34 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} run: yarn install --frozen-lockfile +# create-cache-e2e: +# runs-on: ubuntu-latest +# container: cypress/browsers:node16.18.0-chrome107-ff106-edge +# steps: +# - name: Checkout source code +# uses: actions/checkout@v3 +# - name: Setup Node +# uses: actions/setup-node@v3 +# with: +# node-version: 16.x +# - name: Get yarn cache directory path +# id: yarn-cache-dir-path +# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" +# - name: Cache +# uses: actions/cache@v3 +# with: +# path: | +# ~/.cache +# ${{ steps.yarn-cache-dir-path.outputs.dir }} +# node_modules +# key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} +# restore-keys: | +# ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} +# ${{ runner.os }}-build-${{ env.cache-version }}- +# - name: yarn install +# env: +# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} +# run: yarn install --frozen-lockfile test: runs-on: ubuntu-latest steps: @@ -149,6 +177,130 @@ jobs: GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} BRANCH_NAME: "screenshot" run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts +# test-e2e-chrome: +# runs-on: ubuntu-latest +# container: cypress/browsers:node16.18.0-chrome107-ff106-edge +# steps: +# - name: Checkout source code +# uses: actions/checkout@v3 +# - name: install apt +# run: | +# apt-get -y update +# apt-get -y install fonts-noto unzip build-essential +# - uses: denoland/setup-deno@v1 +# with: +# deno-version: 'v1.x' +# - name: Get yarn cache directory path +# id: yarn-cache-dir-path +# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" +# - name: Cache +# uses: actions/cache/restore@v3 +# with: +# path: | +# ~/.cache +# ${{ steps.yarn-cache-dir-path.outputs.dir }} +# node_modules +# key: ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} +# restore-keys: | +# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} +# ${{ runner.os }}-e2e-build-${{ env.cache-version }}- +# - name: yarn install +# env: +# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} +# run: yarn install --frozen-lockfile +# - name: chmod +# run: | +# chmod 777 -R /github/home/ +# chmod 777 -R src/ +# chmod 777 -R /__w/blog/blog/ +# chmod 777 -R /root/ +# - name: Test e2e +# env: +# GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} +# GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} +# GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} +# GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} +# GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} +# GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} +# GATSBY_GITHUB_SHA: ${{ github.sha }} +# FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} +# NETLIFY_ENV: deploy-preview +# run: yarn test:e2e:ci:chrome +# - name: Get PR Number +# id: get-pr-num +# run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}" +# - name: Add file +# env: +# FILE_PATH: ./cypress/videos/e2e/main.spec.ts.mp4 +# FILE_NAME: video-chrome-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4 +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# HEAD_REF: ${{ github.head_ref }} +# GITHUB_REPOSITORY: "tubone24/blog" +# GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} +# BRANCH_NAME: "screenshot" +# run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts +# test-e2e-firefox: +# runs-on: ubuntu-latest +# container: cypress/browsers:node16.18.0-chrome107-ff106-edge +# steps: +# - name: Checkout source code +# uses: actions/checkout@v3 +# - name: install apt +# run: | +# apt-get -y update +# apt-get -y install fonts-noto unzip build-essential +# - uses: denoland/setup-deno@v1 +# with: +# deno-version: 'v1.x' +# - name: Get yarn cache directory path +# id: yarn-cache-dir-path +# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" +# - name: Cache +# uses: actions/cache/restore@v3 +# with: +# path: | +# ~/.cache +# ${{ steps.yarn-cache-dir-path.outputs.dir }} +# node_modules +# key: ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} +# restore-keys: | +# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} +# ${{ runner.os }}-e2e-build-${{ env.cache-version }}- +# - name: yarn install +# env: +# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} +# run: yarn install --frozen-lockfile +# - name: chmod +# run: | +# chmod 777 -R /github/home/ +# chmod 777 -R src/ +# chmod 777 -R /__w/blog/blog/ +# chmod 777 -R /root/ +# - name: Test e2e +# env: +# GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} +# GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} +# GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} +# GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} +# GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} +# GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} +# GATSBY_GITHUB_SHA: ${{ github.sha }} +# FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} +# NETLIFY_ENV: deploy-preview +# run: yarn test:e2e:ci:firefox +# - name: Get PR Number +# id: get-pr-num +# run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}" +# - name: Add file +# env: +# FILE_PATH: ./cypress/videos/e2e/main.spec.ts.mp4 +# FILE_NAME: video-firefox-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4 +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# HEAD_REF: ${{ github.head_ref }} +# GITHUB_REPOSITORY: "tubone24/blog" +# GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} +# BRANCH_NAME: "screenshot" +# run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts lint: runs-on: ubuntu-latest steps: diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..cffe8cdef1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact=true diff --git a/functions/src/csp-report.js b/functions/src/csp-report.js index fc47f64a41..53cddedbb7 100644 --- a/functions/src/csp-report.js +++ b/functions/src/csp-report.js @@ -1,9 +1,12 @@ import * as Sentry from "@sentry/node"; import "@sentry/tracing"; +import { ProfilingIntegration } from "@sentry/profiling-node"; Sentry.init({ dsn: "https://aa2f31c272db4f8494e3903a43cc5ca6@o302352.ingest.sentry.io/4504433289986048", tracesSampleRate: 1.0, + integrations: [new ProfilingIntegration()], + profilesSampleRate: 1.0, }); const transaction = Sentry.startTransaction({ diff --git a/owasp/Dockerfile b/owasp/Dockerfile index b089efe9c8..c06ba794e9 100644 --- a/owasp/Dockerfile +++ b/owasp/Dockerfile @@ -4,5 +4,5 @@ ENV NODE_ENV production WORKDIR /app COPY ["package.json", "./"] COPY ["public", "public"] -RUN npm install -g serve -CMD ["serve", "-s", "-l", "9000", "public"] \ No newline at end of file +RUN npm install -g serve@14.1.2 +CMD ["serve", "-s", "-l", "9000", "public"] diff --git a/package.json b/package.json index c2aba91474..552a480037 100644 --- a/package.json +++ b/package.json @@ -110,9 +110,13 @@ "test:storybook": "npm test storybook.test.ts", "cypress:open": "cypress open", "cypress:run": "cypress run", + "cypress:run:chrome": "cypress run --browser chrome", + "cypress:run:firefox": "cypress run --browser firefox", "cypress:base": "cypress run --env type=base --config screenshotsFolder=cypress/snapshots/base,testFiles=\\\"**/*main.spec.ts\\\"", "test:e2e": "start-server-and-test develop:e2e http://localhost:8000 cypress:open", "test:e2e:ci": "start-server-and-test develop:e2e http://localhost:8000 cypress:run", + "test:e2e:ci:chrome": "start-server-and-test develop:e2e http://localhost:8000 cypress:run:chrome", + "test:e2e:ci:firefox": "start-server-and-test develop:e2e http://localhost:8000 cypress:run:firefox", "test:e2e:base": "start-server-and-test develop:e2e http://localhost:8000 cypress:base", "functions": "netlify-lambda serve functions", "clean": "gatsby clean",