Skip to content

Commit

Permalink
Add CI workflow for frontend-react
Browse files Browse the repository at this point in the history
  • Loading branch information
fussel178 committed Dec 14, 2023
1 parent 542df05 commit 3ec7e76
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 135 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/frontend-react-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Frontend React CI

# Events that trigger this workflow
on: [push, pull_request]

# Defines which tool versions should be used in all workflow jobs
env:
node: '20'
pnpm: '8'

jobs:
style:
name: Style
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v2.4.0
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'

- name: Install dependencies 📚
run: pnpm install
working-directory: ./frontend-react
- name: Check code style 🧽
run: pnpm run ci:style
working-directory: ./frontend-react

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v2.4.0
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'

- name: Install dependencies 📚
run: pnpm install
working-directory: ./frontend-react
- name: Run Linter 📑
run: pnpm run lint
working-directory: ./frontend-react

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v2.4.0
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'

- name: Install dependencies 📚
run: pnpm install
working-directory: ./frontend-react
- name: Build library 📦
run: pnpm run build
working-directory: ./frontend-react
- name: Pack library 📦
run: pnpm pack
working-directory: ./frontend-react

- name: Upload package artifact 📤
uses: actions/upload-artifact@v3.1.3
with:
name: package.tgz
path: ./frontend-react/wuespace-telestion-*.tgz
retention-days: 7

unit-test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v2.4.0
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'

- name: Install dependencies 📚
run: pnpm install
working-directory: ./frontend-react
- name: Run unit tests 🛃
run: |
pnpm run build
pnpm run ci:test
working-directory: ./frontend-react
3 changes: 3 additions & 0 deletions frontend-react/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ doc
*.njsproj
*.sln
*.sw?

# packages
*.tgz
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { Given } from "@cucumber/cucumber";
import { Given } from '@cucumber/cucumber';

Given(/^Default user data exists$/, function() {

});
Given(/^No default user data exists$/, function() {

});
Given(/^Default user data exists$/, function () {});
Given(/^No default user data exists$/, function () {});
8 changes: 3 additions & 5 deletions frontend-react/features/step_definitions/common-steps.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Then } from "@cucumber/cucumber";
import { Then } from '@cucumber/cucumber';

Then(/^I see an error message$/, function() {

});
Then(/^I see the message "([^"]*)"$/, function(message: string) {
Then(/^I see an error message$/, function () {});
Then(/^I see the message "([^"]*)"$/, function (message: string) {
console.log(message);
});
6 changes: 2 additions & 4 deletions frontend-react/features/step_definitions/dashboard-steps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Then } from "@cucumber/cucumber";
import { Then } from '@cucumber/cucumber';

Then(/^I see a dashboard$/, function() {

});
Then(/^I see a dashboard$/, function () {});
30 changes: 8 additions & 22 deletions frontend-react/features/step_definitions/user-data-steps.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
import { Given, Then } from "@cucumber/cucumber";
import { Given, Then } from '@cucumber/cucumber';

Given(/^My user data is up to date$/, function() {
Given(/^My user data is up to date$/, function () {});
Given(/^I have a dashboard$/, function () {});
Given(/^My user data is out of date$/, function () {});
Given(/^I do not have a dashboard$/, function () {});
Then(/^I have the option to use the default user data$/, function () {});
Given(/^I am a new user$/, function () {});

});
Given(/^I have a dashboard$/, function() {

});
Given(/^My user data is out of date$/, function() {

});
Given(/^I do not have a dashboard$/, function() {

});
Then(/^I have the option to use the default user data$/, function() {

});
Given(/^I am a new user$/, function() {

});

Given(/^I am an existing user$/, function() {

});
Given(/^I am an existing user$/, function () {});
6 changes: 2 additions & 4 deletions frontend-react/features/step_definitions/user-steps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { When } from "@cucumber/cucumber";
import { When } from '@cucumber/cucumber';

When(/^I log in$/, function() {

});
When(/^I log in$/, function () {});
13 changes: 9 additions & 4 deletions frontend-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"private": true,
"version": "1.0.0-alpha.0",
"type": "module",
"files": ["dist", "types"],
"files": [
"dist",
"types"
],
"main": "./dist/telestion.umd.cjs",
"exports": {
".": {
Expand All @@ -32,7 +35,9 @@
"test": "vitest --ui",
"style": "prettier --write .",
"preview": "vite preview",
"docs": "typedoc"
"docs": "typedoc",
"ci:style": "prettier --list-different .",
"ci:test": "vitest"
},
"dependencies": {
"@popperjs/core": "^2.11.8",
Expand All @@ -53,7 +58,7 @@
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"@vitest/ui": "^0.34.6",
"@vitest/ui": "^1.0.4",
"eslint": "^8.53.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand All @@ -68,6 +73,6 @@
"typedoc-plugin-zod": "^1.1.0",
"typescript": "^5.2.2",
"vite": "^5.0.5",
"vitest": "^0.34.6"
"vitest": "^1.0.4"
}
}
Loading

0 comments on commit 3ec7e76

Please sign in to comment.