Skip to content

Commit

Permalink
chore: setup gh actions ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Oct 18, 2024
1 parent e6a128d commit 8acdc1c
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/actions/cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Node modules cache
description: Retrieve and cache project node_modules
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# cache node modules for all jobs to use
- uses: actions/cache@v4
id: node_modules-cache
with:
path: |
**/node_modules
key: install-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
11 changes: 11 additions & 0 deletions .github/actions/cypress-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Cypress runner cache
description: Retrieve and cache the cypress runner
runs:
using: "composite"
steps:
# cache cypress runner
- uses: actions/cache@v4
id: cypress-cache
with:
path: /home/runner/.cache/Cypress
key: cypress-runner-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
67 changes: 67 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Frontend components CI pipeline
on:
pull_request:
branches:
- master
- nx
push:
branches:
- master
- nx

jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: './.github/actions/cache'
- name: Install dependencies
run: npm i
build:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: './.github/actions/cache'
- name: Build
run: npx nx run-affected -t build --exclude=demo
unit-test:
runs-on: ubuntu-latest
needs: [install, build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: './.github/actions/cache'
- name: Run unit tests
run: npx nx run-affected -t test:unit --exclude=demo
component-test:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: './.github/actions/cache'
- uses: './.github/actions/cypress-cache'
- name: Run component tests
run: npx nx run-affected -t test:component --exclude=demo
lint:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: './.github/actions/cache'
- name: Lint
run: npx nx run-affected -t test:lint --exclude=demo

0 comments on commit 8acdc1c

Please sign in to comment.