Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/using sam #45

Merged
merged 13 commits into from
Dec 17, 2024
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
84 changes: 0 additions & 84 deletions .eslintrc.cjs

This file was deleted.

13 changes: 5 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [21.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4

- name: Use bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build
run: npm run build
run: bun run build
21 changes: 13 additions & 8 deletions .github/workflows/build_storybook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ jobs:
build-storybook:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [21.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4

- name: Use bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Build
run: npm run build-storybook
run: bun run build-storybook

build-storybook-with-docker:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the docker image
run: docker build . --file Dockerfile
31 changes: 21 additions & 10 deletions .github/workflows/code_coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
name: Test
name: "Coverage"

on:
workflow_call:

jobs:
code-coverage:
coverage:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [21.x]
permissions:
# Required to checkout the code
contents: read
# Required to put a comment into the pull-request
pull-requests: write

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4

- name: Use bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: "Check coverage"
run: bun run test:coverage-ci

- name: Unit tests
run: npm run test:coverage
- name: 'Report Coverage'
# Set if: always() to also generate the report if tests are failing
# Only works if you set `reportOnFailure: true` in your vite config as specified above
if: always()
uses: davelosert/vitest-coverage-report-action@v2
18 changes: 18 additions & 0 deletions .github/workflows/eslint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ESLint
on:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Linting
run: bun run lint
21 changes: 0 additions & 21 deletions .github/workflows/lint.yaml

This file was deleted.

13 changes: 7 additions & 6 deletions .github/workflows/npm_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ permissions:
jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 21.x

- name: Use bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Run Tests
run: npm run test:ci
run: bun run test:ci

- name: Build Components
run: npm run build
run: bun run build-components

- uses: JS-DevTools/npm-publish@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
- ".github/workflows/**"
workflow_dispatch:
jobs:
lint:
name: Lint
uses: ./.github/workflows/lint.yaml
eslint:
name: ESLint
uses: ./.github/workflows/eslint.yaml

test:
name: Test
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [21.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4

- name: Use bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile

- name: Unit tests
run: npm run test:ci
- name: Tests
run: bun run test:ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.pnp.js
/dist
/lib
package-lock.json

# testing
/coverage
Expand Down
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .run/Code coverage.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<node-interpreter value="project" />
<vitest-package value="$PROJECT_DIR$/node_modules/vitest" />
<working-dir value="$PROJECT_DIR$" />
<vitest-options value="--coverage" />
<vitest-options value="--coverage --watch" />
<envs />
<scope-kind value="ALL" />
<method v="2" />
Expand Down
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const config = {
docs: {
autodocs: true,
},
staticDirs: ['../static'],
staticDirs: ['../public'],
async viteFinal(config) {
return {
...config,
Expand Down
1 change: 0 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { tokens } from '@equinor/eds-tokens';

import { Preview } from '@storybook/react';

const { colors } = tokens;
Expand Down
29 changes: 11 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
# Base
FROM node:21-alpine as base
FROM imbios/bun-node:22-alpine AS base
WORKDIR /app
COPY package*.json ./
COPY tsconfig*.json ./
COPY package.json ./
COPY bun.lockb ./
COPY tsconfig.json ./
COPY src ./src
COPY .storybook ./.storybook
COPY public ./public
COPY eslint.config.js ./
COPY vite.config.ts ./

# Dependencies
FROM base as dependencies
WORKDIR /app
RUN npm ci --ignore-scripts
COPY src src
COPY .storybook .storybook
COPY static static
COPY .eslintrc.cjs .eslintrc.cjs
COPY vite.config.ts vite.config.ts

# Build
FROM dependencies as builder
WORKDIR /app
RUN npm run build-storybook
RUN bun install --frozen-lockfile && bun run build-storybook

# STAGE 2 => SETUP NGINX and Run
FROM nginxinc/nginx-unprivileged:alpine
USER 0
# Clear default nginx html file
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/storybook-static /usr/share/nginx/html
COPY --from=base /app/storybook-static /usr/share/nginx/html
COPY proxy/nginx.conf /etc/nginx/conf.d/default.conf.template
COPY proxy/securityheaders.conf /etc/nginx/securityheaders.conf

Expand Down
Binary file added bun.lockb
Binary file not shown.
Loading
Loading