-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from scientist-softserv/sentry-for-next-js
8 setup exception tracking
- Loading branch information
Showing
17 changed files
with
427 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,78 @@ | ||
name: "Build Docker Images" | ||
run-name: Build of ${{ github.ref_name }} by @${{ github.actor }} | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
type: boolean | ||
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
required: false | ||
default: false | ||
# we are running the build in vercel now so we don't need this github action | ||
# commenting this out because this action kept failing on https://github.com/scientist-softserv/webstore/pull/268 | ||
# TODO(alishaevn): figure out the sentry error if we switch from vercel to an in house deploy infrastructure | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
# name: "Build Docker Images" | ||
# run-name: Build of ${{ github.ref_name }} by @${{ github.actor }} | ||
# on: | ||
# push: | ||
# branches: | ||
# - main | ||
# pull_request: | ||
# branches: | ||
# - main | ||
# workflow_dispatch: | ||
# inputs: | ||
# debug_enabled: | ||
# type: boolean | ||
# description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
# required: false | ||
# default: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- id: setup | ||
name: Setup | ||
uses: scientist-softserv/actions/[email protected] | ||
with: | ||
tag: ${{ inputs.tag }} | ||
image_name: ${{ inputs.image_name }} | ||
token: ${{ secrets.CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://npm.pkg.github.com' | ||
# Defaults to the user or organization that owns the workflow file | ||
scope: '@scientist-softserv' | ||
node-version-file: package.json | ||
- name: GPR authToken | ||
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > $NPM_CONFIG_USERCONFIG | ||
- name: GPR alias | ||
run: echo "@scientist-softserv:registry=https://npm.pkg.github.com" >> $NPM_CONFIG_USERCONFIG | ||
- run: yarn install | ||
- run: yarn test | ||
# env: | ||
# REGISTRY: ghcr.io | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# permissions: | ||
# contents: read | ||
# packages: write | ||
# steps: | ||
# - id: setup | ||
# name: Setup | ||
# uses: scientist-softserv/actions/[email protected] | ||
# with: | ||
# tag: ${{ inputs.tag }} | ||
# image_name: ${{ inputs.image_name }} | ||
# token: ${{ secrets.CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }} | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# registry-url: 'https://npm.pkg.github.com' | ||
# # Defaults to the user or organization that owns the workflow file | ||
# scope: '@scientist-softserv' | ||
# node-version-file: package.json | ||
# - name: GPR authToken | ||
# run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > $NPM_CONFIG_USERCONFIG | ||
# - name: GPR alias | ||
# run: echo "@scientist-softserv:registry=https://npm.pkg.github.com" >> $NPM_CONFIG_USERCONFIG | ||
# - run: yarn install | ||
# - run: yarn test | ||
|
||
- name: Retag action for Docker image | ||
id: meta-docker-image | ||
uses: docker/[email protected] | ||
with: | ||
images: | | ||
name=${{ env.REGISTRY }}/${{ env.REPO_LOWER }} | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# - name: Login to GitHub Container Registry | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# registry: ${{ env.REGISTRY }} | ||
# username: ${{ github.actor }} | ||
# password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: cp $NPM_CONFIG_USERCONFIG .npmrc; cat .npmrc | ||
# - name: Retag action for Docker image | ||
# id: meta-docker-image | ||
# uses: docker/[email protected] | ||
# with: | ||
# images: | | ||
# name=${{ env.REGISTRY }}/${{ env.REPO_LOWER }} | ||
# tags: | | ||
# type=raw,value=latest,enable={{is_default_branch}} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }} | ||
context: . | ||
push: true | ||
tags: | | ||
${{ steps.meta-docker-image.outputs.tags }} | ||
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }} | ||
# - run: cp $NPM_CONFIG_USERCONFIG .npmrc; cat .npmrc | ||
|
||
# - name: Build and push Docker image | ||
# uses: docker/build-push-action@v3 | ||
# with: | ||
# cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }} | ||
# context: . | ||
# push: true | ||
# tags: | | ||
# ${{ steps.meta-docker-image.outputs.tags }} | ||
# ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
name: "Deploy" | ||
run-name: Deploy (${{ github.ref_name }} -> ${{ inputs.environment }}) by @${{ github.actor }} | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: 'Deploy to Environment' | ||
required: true | ||
default: 'staging' | ||
type: choice | ||
options: | ||
- staging | ||
debug_enabled: | ||
type: boolean | ||
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
required: false | ||
default: false | ||
# we are running the deploy through vercel now so we don't need this github action | ||
# TODO(alishaevn): fix any potential sentry error's if we switch from vercel to an in house deploy infrastructure | ||
|
||
jobs: | ||
deploy: | ||
uses: scientist-softserv/actions/.github/workflows/[email protected] | ||
secrets: inherit | ||
# name: "Deploy" | ||
# run-name: Deploy (${{ github.ref_name }} -> ${{ inputs.environment }}) by @${{ github.actor }} | ||
# on: | ||
# workflow_dispatch: | ||
# inputs: | ||
# environment: | ||
# description: 'Deploy to Environment' | ||
# required: true | ||
# default: 'staging' | ||
# type: choice | ||
# options: | ||
# - staging | ||
# debug_enabled: | ||
# type: boolean | ||
# description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
# required: false | ||
# default: false | ||
|
||
# jobs: | ||
# deploy: | ||
# uses: scientist-softserv/actions/.github/workflows/[email protected] | ||
# secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
name: Test Suite | ||
on: | ||
push: {} | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# Setup .npmrc file to publish to GitHub Packages | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://npm.pkg.github.com' | ||
# Defaults to the user or organization that owns the workflow file | ||
scope: '@scientist-softserv' | ||
node-version-file: package.json | ||
- name: Authenticate with private GPR package | ||
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > $NPM_CONFIG_USERCONFIG | ||
- run: yarn install | ||
- run: yarn test | ||
- run: yarn build | ||
# TODO(alishaevn): remove the references to the github package registry | ||
# TODO(alishaevn): run the cypress tests during this action | ||
|
||
# name: Test Suite | ||
# on: | ||
# push: {} | ||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# permissions: | ||
# contents: read | ||
# packages: write | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# # Setup .npmrc file to publish to GitHub Packages | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# registry-url: 'https://npm.pkg.github.com' | ||
# # Defaults to the user or organization that owns the workflow file | ||
# scope: '@scientist-softserv' | ||
# node-version-file: package.json | ||
# - name: Authenticate with private GPR package | ||
# run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > $NPM_CONFIG_USERCONFIG | ||
# - run: yarn install | ||
# - run: yarn test | ||
# - run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,43 @@ | ||
// This file sets a custom webpack configuration to use your Next.js app | ||
// with Sentry. | ||
// https://nextjs.org/docs/api-reference/next.config.js/introduction | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ | ||
const { withSentryConfig } = require('@sentry/nextjs') | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
const moduleExports = { | ||
output: 'standalone', | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
eslint: { | ||
dirs: ['pages', 'utils'], // Only run ESLint on the 'pages' and 'utils' directories during production builds | ||
}, | ||
sentry: { | ||
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool` | ||
// for client-side builds. (This will be the default starting in | ||
// `@sentry/nextjs` version 8.0.0.) See | ||
// https://webpack.js.org/configuration/devtool/ and | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map | ||
// for more information. | ||
hideSourceMaps: true, | ||
}, | ||
} | ||
|
||
const sentryWebpackPluginOptions = { | ||
// Additional config options for the Sentry Webpack plugin. Keep in mind that | ||
// the following options are set automatically, and overriding them is not | ||
// recommended: | ||
// release, url, org, project, authToken, configFile, stripPrefix, | ||
// urlPrefix, include, ignore | ||
|
||
silent: true, // Suppresses all logs | ||
// For all available options, see: | ||
// https://github.com/getsentry/sentry-webpack-plugin#options. | ||
} | ||
|
||
module.exports = nextConfig | ||
// Make sure adding Sentry options is the last code to run before exporting, to | ||
// ensure that your source maps include changes from all other Webpack plugins | ||
module.exports = withSentryConfig( | ||
moduleExports, | ||
sentryWebpackPluginOptions | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.