Skip to content
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
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: YAMG Build & Test

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

permissions:
contents: read
id-token: write

concurrency:
group: "pages-build"
cancel-in-progress: false

jobs:
build-and-test:
runs-on: ubuntu-latest
outputs:
build-path: ./out
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
else
echo "Unable to determine package manager"
exit 1
fi

- name: Setup Node
uses: pnpm/action-setup@v4
with:
version: 10
cache: ${{ steps.detect-package-manager.outputs.manager }}

- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
node_modules
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Run unit tests
run: pnpm test

- name: Build with Next.js
run: pnpm run build

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: nextjs-build
path: ./out
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: YAMG Deploy

on:
push:
branches: ["main"]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages-deploy"
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: nextjs-build
path: ./out

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
95 changes: 0 additions & 95 deletions .github/workflows/nextjs.yml

This file was deleted.

16 changes: 16 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Config } from "jest"

const config: Config = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/tests/**/*.test.ts", "**/tests/**/*.test.tsx"],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1", // match your tsconfig paths
},
transform: {
"^.+\\.tsx?$": "ts-jest", // transform TS files
},
clearMocks: true,
}

export default config
Loading
Loading