Skip to content

Commit

Permalink
Merge pull request #3 from Samoten777/ci/test
Browse files Browse the repository at this point in the history
ci: added test step and caching node modules for faster builds
  • Loading branch information
Samoten777 authored Feb 18, 2024
2 parents 5fea0fa + 5cb0dd4 commit 9c99f37
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Build Frontend
name: Test & Build Frontend

on:
push:
Expand All @@ -10,21 +10,41 @@ on:
branches: [ "main" ]

jobs:
build:
main:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: $(yarn cache dir)
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js 10.15
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 10.15
cache: 'npm'
- run: npm i
- run: npm run build:prod
cache: 'yarn'
- run: yarn

- name: Test frontend
run: yarn test

- name: Build frontend
if: success()
run: yarn build:prod

- name: Archive production artifacts
if: success()
Expand Down

0 comments on commit 9c99f37

Please sign in to comment.