diff --git a/.github/workflows/CI_frontend.yml b/.github/workflows/CI_frontend.yml new file mode 100644 index 0000000..5f83a63 --- /dev/null +++ b/.github/workflows/CI_frontend.yml @@ -0,0 +1,55 @@ +name: "React frontend CI" + +# events +on: + push: + branches: ["main","develop"] + # paths + paths: + - 'frontend/**' + pull_request: + branches: ["main","develop"] + # paths + paths: + - 'frontend/**' + +env: + node_version: 22.x +defaults: + run: + working-directory: ./frontend + +jobs: + build: #first job + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4.1.7 # action + + - name: Use Node.js ${{ env.node_version }} + uses: actions/setup-node@v4.0.3 + with: + node-version: ${{ env.node_version }} + cache: 'npm' + cache-dependency-path: './frontend/package-lock.json' + + - name: Run npm clean install + run: npm ci + + - run: npm run build --if-present + + test: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4.1.7 # action + + - name: Use Node.js ${{ env.node_version }} + uses: actions/setup-node@v4.0.3 + with: + node-version: ${{ env.node_version }} + cache: 'npm' + cache-dependency-path: './frontend/package-lock.json' + - name: "Run test on frontend" + run: npm ci + - run: npm test \ No newline at end of file diff --git a/frontend/README.md b/frontend/README.md index 58beeac..e5a2820 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -68,3 +68,5 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/d ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) + +testing \ No newline at end of file