Skip to content

Commit

Permalink
feat: add GitHub actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
TomatoVan committed Nov 2, 2023
1 parent cef1823 commit 3f401d0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
name: linting, testing, building
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Explore-GitHub-Actions:
pipeline:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 17.x ]

steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
- uses: actions/checkout@v2
- name: Staring Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install modules
run: npm install
- name: build production project
run: npm run build:prod
- name: linting typescript
run: npm run lint:ts
- name: linting css
run: npm run lint:scss
- name: unit testing
run: npm run test:unit
- name: build storybook
run: npm run storybook:build
- name: screenshot testing
run: npm run test:ui:ci


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
node_modules
.idea
/storybook-static
15 changes: 10 additions & 5 deletions config/build/buildPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { BuildOptions } from './types/config';

export function buildPlugins({ paths, isDev }: BuildOptions): webpack.WebpackPluginInstance[] {
return [
const plugins = [
new HtmlWebpackPlugin({
template: paths.html,
}),
Expand All @@ -17,9 +17,14 @@ export function buildPlugins({ paths, isDev }: BuildOptions): webpack.WebpackPlu
new webpack.DefinePlugin({
__IS_DEV__: JSON.stringify(isDev),
}),
new webpack.HotModuleReplacementPlugin(),
new BundleAnalyzerPlugin({
openAnalyzer: false,
}),
];

if (isDev) {
plugins.push(new webpack.HotModuleReplacementPlugin());
plugins.push(new BundleAnalyzerPlugin({
openAnalyzer: false,
}));
}

return plugins;
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"lint:scss": "npx stylelint \"**/*.scss\"",
"lint:scss:fix": "npx stylelint \"**/*.scss\" --fix",
"test:unit": "jest --config ./config/jest/jest.config.ts",
"test:ui": "yarn loki test",
"test:ui:ok": "yarn loki approve",
"test:ui": "npx loki test",
"test:ui:ok": "npx loki approve",
"test:ui:ci": "loki --requireReference --reactUri file:./storybook-static",
"storybook": "start-storybook -p 6006 -c ./config/storybook",
"storybook:build": "build-storybook -c ./config/storybook"
},
Expand Down

0 comments on commit 3f401d0

Please sign in to comment.