-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup project with layout.tsx, CAS auth, and .github (#1)
- Loading branch information
Showing
56 changed files
with
2,171 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Ticket Link | ||
|
||
[Ticket](Insert Link Here) | ||
|
||
# List of squashed commits | ||
|
||
- Commit 1 | ||
- Commit 2 | ||
- Commit 3 | ||
|
||
# Test Checklist | ||
|
||
- [ ] Unit Tests Passed | ||
- [ ] Integration Tests Passed | ||
- [ ] General Visual Inspection |
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 |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: Generate badges | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
create-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name 'Groupings Project' | ||
git config --global user.email '[email protected]' | ||
- name: Create the badges branch if it doesn't exist | ||
run: | | ||
branch_name="badges" | ||
if ! git ls-remote --exit-code origin refs/heads/$branch_name; then | ||
echo "Branch $branch_name does not exist. Creating it..." | ||
git checkout --orphan $branch_name | ||
git rm -rf . | ||
git commit --allow-empty -m "Create $branch_name branch" | ||
git push -u origin $branch_name | ||
else | ||
echo "Branch $branch_name already exists." | ||
fi | ||
generate-jest-badges: | ||
needs: create-branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Installing dependencies | ||
run: | | ||
cd ui | ||
npm install | ||
- name: Tests | ||
run: | | ||
cd ui | ||
npm run test:coverage | ||
- name: Switch to badges branch | ||
run: | | ||
git fetch | ||
git switch badges | ||
- name: Generating coverage badges | ||
uses: jpb06/jest-badges-action@latest | ||
with: | ||
branches: '*' | ||
coverage-summary-path: ui/coverage/coverage-summary.json | ||
no-commit: true | ||
target-branch: badges | ||
|
||
- name: Commit and push badges | ||
run: | | ||
cd badges | ||
if [[ `git status --porcelain *.svg` ]]; then | ||
git config --global user.name 'Groupings Project' | ||
git config --global user.email '[email protected]' | ||
git add *.svg | ||
git commit -m "Autogenerated Jest badges" *.svg | ||
git push origin badges -f | ||
fi | ||
# Re-enable once UH Groupings API is added to this repo | ||
# generate-jacoco-badges: | ||
# needs: create-branch | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v3 | ||
# with: | ||
# fetch-depth: 0 | ||
|
||
# - name: Set up JDK 17 | ||
# uses: actions/setup-java@v1 | ||
# with: | ||
# java-version: 17 | ||
|
||
# - name: Build with Maven and Generate JaCoCo Report | ||
# run: | | ||
# mvn clean test jacoco:report -f api/pom.xml -D'logging.level.edu.hawaii.its.holiday=OFF' -D'logging.level.org.springframework=ERROR' -D'spring.main.banner-mode=off' | ||
# mv api/target/ target/ | ||
|
||
# - name: Switch to badges branch | ||
# run: | | ||
# git fetch | ||
# git switch badges | ||
|
||
# - name: Generate Jacoco Badge | ||
# id: jacoco | ||
# uses: cicirello/jacoco-badge-generator@v2 | ||
# with: | ||
# coverage-label: junit coverage | ||
# badges-directory: badges | ||
# generate-branches-badge: true | ||
|
||
# - name: Log coverage percentage | ||
# run: | | ||
# echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | ||
|
||
# - name: Commit and push | ||
# if: ${{ github.event_name != 'pull_request' }} | ||
# run: | | ||
# cd badges | ||
# if [[ `git status --porcelain *.svg` ]]; then | ||
# git config --global user.name 'Groupings Project' | ||
# git config --global user.email '[email protected]' | ||
# git add *.svg | ||
# git commit -m "Autogenerated JaCoCo coverage badge" *.svg | ||
# git push origin badges -f | ||
# fi | ||
|
||
# - name: Upload Jacoco coverage report | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: jacoco-report | ||
# path: target/site/jacoco/ |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
# Re-enable once UH Groupings API is added to this repo | ||
# junit: | ||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Set up JDK 17 | ||
# uses: actions/setup-java@v1 | ||
# with: | ||
# java-version: 17 | ||
|
||
# - name: Build with Maven | ||
# run: | | ||
# cd api | ||
# mvn clean test | ||
|
||
jest: | ||
strategy: | ||
matrix: | ||
node-version: [ 18.x, 20.x ] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
cd ui | ||
npm install | ||
- name: Run ESLint | ||
run: | | ||
cd ui | ||
npm run lint | ||
- name: Run Jest Tests | ||
run: | | ||
cd ui | ||
npm run test |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# ========================================================================= | ||
NEXT_PUBLIC_BASE_URL=http://localhost:8080/uhgroupings | ||
NEXT_PUBLIC_API_2_1_BASE_URL=http://localhost:8081/uhgroupingsapi/api/groupings/v2.1 | ||
|
||
# ========================================================================= | ||
# CAS. | ||
NEXT_PUBLIC_CAS_URL=https://cas-test.its.hawaii.edu/cas | ||
NEXT_PUBLIC_SAML_REQUEST_TEMPLATE=<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><samlp:Request xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" MajorVersion="1" MinorVersion="1" RequestID="%s" IssueInstant="%s"><samlp:AssertionArtifact>%s</samlp:AssertionArtifact></samlp:Request></SOAP-ENV:Body></SOAP-ENV:Envelope> | ||
|
||
# ========================================================================= | ||
# Test Properties. | ||
TEST_USER_A={ "name": "Testf-iwt-a TestIAM-staff", "firstName": "Testf-iwt-a", "lastName": "TestIAM-staff", "uid": "testiwta", "uhUuid": "99997010", "roles": [] } | ||
XML_SOAP_RESPONSE=<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><saml1p:Response xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol" InResponseTo="myserver.example.edu" IssueInstant="2018-05-03T19:50:56.390Z" MajorVersion="1" MinorVersion="1" ResponseID="_0044d5b611aac99d82cb9926281bbd30"><saml1p:Status><saml1p:StatusCode Value="saml1p:Success"/></saml1p:Status><saml1:Assertion xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" AssertionID="_0b1889b7ce444ecbe8cfd131501c4f59" IssueInstant="2018-05-03T19:50:56.390Z" Issuer="localhost" MajorVersion="1" MinorVersion="1"><saml1:Conditions NotBefore="2018-05-03T19:50:56.390Z" NotOnOrAfter="2018-05-03T19:51:26.390Z"><saml1:AudienceRestrictionCondition><saml1:Audience>https://myserver.example.edu/myapp</saml1:Audience></saml1:AudienceRestrictionCondition></saml1:Conditions><saml1:AuthenticationStatement AuthenticationInstant="2018-05-03T19:50:56.320Z" AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password"><saml1:Subject><saml1:NameIdentifier>iam_0108</saml1:NameIdentifier><saml1:SubjectConfirmation><saml1:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:artifact</saml1:ConfirmationMethod></saml1:SubjectConfirmation></saml1:Subject></saml1:AuthenticationStatement><saml1:AttributeStatement><saml1:Subject><saml1:NameIdentifier>testiwta</saml1:NameIdentifier><saml1:SubjectConfirmation><saml1:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:artifact</saml1:ConfirmationMethod></saml1:SubjectConfirmation></saml1:Subject><saml1:Attribute AttributeName="mail" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">[email protected]</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="eduPersonAffiliation" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">staff</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="uhUuid" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">99997010</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="givenName" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">Testf-iwt-a</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="eduPersonOrgDN" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">uhsystem</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="cn" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">Testf-iwt-a TestIAM-staff</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="uid" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">testiwta</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="uhEmail" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">[email protected]</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="eduPersonPrincipalName" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">[email protected]</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="sn" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">TestIAM-staff</saml1:AttributeValue></saml1:Attribute><saml1:Attribute AttributeName="uhOrgAffiliation" AttributeNamespace="http://www.ja-sig.org/products/cas/"><saml1:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">eduPersonOrgDN=uhsystem,eduPersonAffiliation=staff</saml1:AttributeValue></saml1:Attribute></saml1:AttributeStatement></saml1:Assertion></saml1p:Response></SOAP-ENV:Body></SOAP-ENV:Envelope> | ||
IRON_SESSION_SECRET=IronSessionSecretForTestingAuthentication |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ========================================================================= | ||
BASE_URL=https://www.hawaii.edu/its/uhgroupings | ||
API_2_1_BASE_URL=http://iws04.pvt.hawaii.edu:8080/uhgroupingsapi/api/groupings/v2.1 | ||
|
||
# ========================================================================= | ||
# CAS. | ||
CAS_URL=https://authn.hawaii.edu/cas |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ========================================================================= | ||
BASE_URL=https://www.test.hawaii.edu/uhgroupings | ||
API_2_1_BASE_URL=http://iws74.pvt.hawaii.edu:8080/uhgroupingsapi/api/groupings/v2.1 |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"next/core-web-vitals" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"], | ||
"extends": ["plugin:testing-library/react"] | ||
} | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"react", | ||
"@typescript-eslint", | ||
"@stylistic", | ||
"eslint-plugin-tsdoc" | ||
], | ||
"rules": { | ||
"@stylistic/max-len": ["error", { "code": 120 }], | ||
"@stylistic/indent": ["error", 4], | ||
"@stylistic/eol-last": ["error", "always"], | ||
"@stylistic/quotes": ["error", "single", { "allowTemplateLiterals": true }], | ||
"@stylistic/arrow-parens": "off", | ||
"@stylistic/linebreak-style": "off", | ||
"react/function-component-definition": [2, { "namedComponents": "arrow-function" }], | ||
"tsdoc/syntax": "warn", | ||
"func-names": "off", | ||
"no-plusplus": "off", | ||
"no-restricted-syntax": "off", | ||
"no-return-assign": "off", | ||
"prefer-arrow-callback": "off" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
package-lock.json | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# 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 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const ironSession = jest.genMockFromModule('iron-session'); | ||
|
||
module.exports = ironSession; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const nextHeaders = jest.genMockFromModule('next/headers'); | ||
|
||
module.exports = nextHeaders; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const nextNavigation = jest.genMockFromModule('next/navigation'); | ||
|
||
module.exports = nextNavigation; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "default", | ||
"rsc": true, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/app/globals.css", | ||
"baseColor": "slate", | ||
"cssVariables": false, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/components/ui/utils" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Config } from 'jest' | ||
import nextJest from 'next/jest.js' | ||
|
||
const createJestConfig = nextJest({ | ||
dir: './', | ||
}); | ||
|
||
const config: Config = { | ||
clearMocks: true, | ||
collectCoverageFrom: [ | ||
'./src/**/*.ts*', | ||
], | ||
coveragePathIgnorePatterns: [ | ||
'./src/components/ui', // Ignore shadcn/ui components | ||
], | ||
coverageReporters: ['json-summary', 'text', 'html'], | ||
testEnvironment: 'jsdom', | ||
testEnvironmentOptions: { | ||
customExportConditions: [] | ||
}, | ||
setupFilesAfterEnv: [ | ||
'<rootDir>/tests/setupJest.tsx' | ||
], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
moduleDirectories: ['node_modules', '<rootDir>'], | ||
moduleNameMapper: { | ||
"^@/(.*)$": "<rootDir>/src/$1" | ||
} | ||
}; | ||
|
||
export default createJestConfig(config); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** @type {import('next').NextConfig} */ | ||
|
||
import dotenv from 'dotenv'; | ||
import os from 'os'; | ||
|
||
// Define path to overrides file | ||
// TODO: Rename uh-groupings-ui-3-0-overrides to uh-groupings-ui-overrides once 3.0 is complete | ||
dotenv.config({path: `${os.homedir()}/.${os.userInfo().username}-conf/uh-groupings-ui-3-0-overrides.properties`}) | ||
|
||
const nextConfig = { | ||
basePath: '/uhgroupings', | ||
experimental: { | ||
serverComponentsExternalPackages: ['camaro'] | ||
} | ||
}; | ||
|
||
export default nextConfig; |
Oops, something went wrong.