Skip to content

Commit 42d32f0

Browse files
authored
Merge pull request #16 from workfloworchestrator/826-add-precommit-hook
826: Add pre-commit hook used in lib
2 parents 24d8800 + 4f73278 commit 42d32f0

File tree

6 files changed

+15623
-57
lines changed

6 files changed

+15623
-57
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Lint, test and build
2+
on: [push]
3+
jobs:
4+
cache-dependencies:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v3
8+
- name: Use Node.js ${{ matrix.node-version }}
9+
uses: actions/setup-node@v3
10+
with:
11+
node-version: ${{ matrix.node-version }}
12+
cache: "npm"
13+
- uses: actions/cache@v2
14+
with:
15+
path: "**/node_modules"
16+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
17+
- name: Installing dependencies
18+
run: npm ci
19+
20+
tsc-and-linting:
21+
runs-on: ubuntu-latest
22+
needs: cache-dependencies
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Use Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: "npm"
30+
- uses: actions/cache@v2
31+
with:
32+
path: "**/node_modules"
33+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
34+
- name: Installing dependencies
35+
run: npm ci
36+
- run: npm run tsc
37+
- run: npm run lint
38+
39+
unit-tests:
40+
runs-on: ubuntu-latest
41+
needs: cache-dependencies
42+
steps:
43+
- uses: actions/checkout@v3
44+
- name: Use Node.js ${{ matrix.node-version }}
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: ${{ matrix.node-version }}
48+
cache: "npm"
49+
- uses: actions/cache@v2
50+
with:
51+
path: "**/node_modules"
52+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
53+
- name: Installing dependencies
54+
run: npm ci
55+
- run: npm run test
56+
57+
build:
58+
runs-on: ubuntu-latest
59+
needs: cache-dependencies
60+
steps:
61+
- uses: actions/checkout@v3
62+
- name: Use Node.js ${{ matrix.node-version }}
63+
uses: actions/setup-node@v3
64+
with:
65+
node-version: ${{ matrix.node-version }}
66+
cache: "npm"
67+
- uses: actions/cache@v2
68+
with:
69+
path: "**/node_modules"
70+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
71+
- name: Installing dependencies
72+
run: npm ci
73+
- run: npm run build

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,5 @@ yarn-error.log*
3636
# vercel
3737
.vercel
3838

39-
# lockfiles
40-
package-lock.json
41-
yarn.lock
42-
4339
# typescript
4440
tsconfig.tsbuildinfo

.husky/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
echo "---------- Running TSC ----------"
5+
npm run tsc
6+
7+
echo "---------- Running Linter ----------"
8+
npm run lint
9+
10+
echo "---------- Running Tests ----------"
11+
npm run test

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ FROM node:18-alpine AS builder
44

55
WORKDIR /build
66
COPY . .
7-
RUN yarn install
8-
RUN yarn build --no-lint
7+
RUN npm install && npm update @orchestrator-ui/orchestrator-ui-components && npm update @orchestrator-ui/eslint-config-custom && npm update @orchestrator-ui/jest-config && npm update @orchestrator-ui/tsconfig
8+
RUN npm run build
9+
910

1011
FROM node:18-alpine AS runner
1112

@@ -16,4 +17,6 @@ COPY --chown=node --from=builder /build .
1617

1718
USER node
1819
EXPOSE 3000
19-
CMD yarn start
20+
CMD npm start
21+
22+

0 commit comments

Comments
 (0)