Skip to content

Commit

Permalink
Merge pull request #65 from ruchernchong/v2
Browse files Browse the repository at this point in the history
v2
  • Loading branch information
ruchernchong authored Jul 27, 2024
2 parents 4be336d + b2146f9 commit 50511f7
Show file tree
Hide file tree
Showing 89 changed files with 6,305 additions and 4,815 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
NEXT_PUBLIC_SITE_URL=
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_GA_MEASUREMENT_ID=
NEXT_PUBLIC_FEATURE_FLAG_RELEASED=
NEXT_PUBLIC_REVALIDATE_TOKEN=
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on:
workflow_call:

jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
92 changes: 92 additions & 0 deletions .github/workflows/sst.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Deployment (Dev)
on:
push:
branches-ignore:
- 'main'

concurrency:
group: merge-${{ github.ref }}

permissions:
id-token: write
contents: read

jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: latest
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Build:
needs: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: latest
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.OS }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
Deploy:
needs: Build
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_FEATURE_FLAG_UNRELEASED: ${{ vars.NEXT_PUBLIC_FEATURE_FLAG_UNRELEASED }}
NEXT_PUBLIC_GA_MEASUREMENT_ID: ${{ vars.NEXT_PUBLIC_GA_MEASUREMENT_ID }}
NEXT_PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }}
NEXT_PUBLIC_REVALIDATE_TOKEN: ${{ secrets.NEXT_PUBLIC_REVALIDATE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.OS }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.ROLE_TO_ASSUME }}
aws-region: ap-southeast-1
- name: Deploy app
run: |
pnpm install && pnpm sst deploy --stage dev
47 changes: 47 additions & 0 deletions .github/workflows/sst.staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deployment (Staging)
on:
push:
branches:
- 'main'
tags-ignore:
- "*"

concurrency:
group: merge-${{ github.ref }}

permissions:
id-token: write
contents: read

jobs:
Deploy:
runs-on: ubuntu-latest
environment: Staging
env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_FEATURE_FLAG_UNRELEASED: ${{ vars.NEXT_PUBLIC_FEATURE_FLAG_UNRELEASED }}
NEXT_PUBLIC_GA_MEASUREMENT_ID: ${{ vars.NEXT_PUBLIC_GA_MEASUREMENT_ID }}
NEXT_PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }}
NEXT_PUBLIC_REVALIDATE_TOKEN: ${{ secrets.NEXT_PUBLIC_REVALIDATE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.OS }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.ROLE_TO_ASSUME }}
aws-region: ap-southeast-1
- name: Deploy app
run: |
pnpm install && pnpm sst deploy --stage staging
67 changes: 0 additions & 67 deletions .github/workflows/sst.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test
on:
workflow_call:

jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
64 changes: 0 additions & 64 deletions app/(cars)/page.tsx

This file was deleted.

46 changes: 46 additions & 0 deletions app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { KeyStatistics } from "@/app/components/KeyStatistics";
import { TotalNewCarRegistrationsByYear } from "@/app/components/TotalNewCarRegistrationsByYear";
import { Top5CarMakesByYear } from "@/app/components/Top5CarMakesByYear";
import Typography from "@/components/Typography";
import { UnreleasedFeature } from "@/components/UnreleasedFeature";

const HomePage = () => {
return (
<section className="flex flex-col gap-y-8">
<Typography.H1>Dashboard</Typography.H1>
<UnreleasedFeature>
<div className="flex flex-col gap-y-4">
<TotalNewCarRegistrationsByYear data={data} />
<KeyStatistics data={data} />
<Top5CarMakesByYear topMakes2023={topMakes2023} />
</div>
</UnreleasedFeature>
</section>
);
};

// TODO: Dummy data for visualisation ONLY
const data = [
{ year: 2013, total: 22472 },
{ year: 2014, total: 28932 },
{ year: 2015, total: 57589 },
{ year: 2016, total: 87504 },
{ year: 2017, total: 91922 },
{ year: 2018, total: 80281 },
{ year: 2019, total: 72344 },
{ year: 2020, total: 44465 },
{ year: 2021, total: 45442 },
{ year: 2022, total: 30939 },
{ year: 2023, total: 30225 },
];

// TODO: Dummy data for visualisation ONLY
const topMakes2023 = [
{ make: "BYD", value: 1416 },
{ make: "Toyota", value: 7248 },
{ make: "BMW", value: 3436 },
{ make: "Mercedes Benz", value: 4317 },
{ make: "Honda", value: 2631 },
];

export default HomePage;
9 changes: 9 additions & 0 deletions app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const AboutPage = () => {
return (
<div>
<h1>About Page</h1>
</div>
);
};

export default AboutPage;
Loading

0 comments on commit 50511f7

Please sign in to comment.