Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Merge pull request #153 from evande0/patch-1 #77

Merge pull request #153 from evande0/patch-1

Merge pull request #153 from evande0/patch-1 #77

Workflow file for this run

# Unique name for this workflow
name: CI
# Definition when the workflow should run
on:
push:
branches:
- master
# Jobs to be executed
jobs:
formatting-and-lwc-tests:
runs-on: ubuntu-latest
steps:
# Checkout the code in the pull request
- name: 'Checkout source code'
uses: actions/checkout@v2
# Cache node_modules to speed up the process
- name: Restore node_modules cache
id: cache-npm
uses: actions/cache@v1
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
# Install npm dependencies for Prettier and Jest
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
# Prettier formatting
- name: 'Code formatting'
run: npm run prettier:verify
# ESlint
- name: 'Linting'
run: npm run lint
# LWC Unit tests
- name: 'LWC unit tests'
run: npm run test:unit
scratch-org-test:
runs-on: ubuntu-latest
needs: formatting-and-lwc-tests
steps:
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz
mkdir ~/sfdx
tar xJf sfdx-linux-x64.tar.xz -C ~/sfdx --strip-components 1
echo "$HOME/sfdx/bin" >> $GITHUB_PATH
~/sfdx/bin/sfdx version
# Checkout the code in the pull request
- name: 'Checkout source code'
uses: actions/checkout@v2
# Store secret for dev hub
- name: 'Populate auth file with DEVHUB_SFDX_URL secret'
shell: bash
run: 'echo ${{ secrets.DEVHUB_SFDX_URL}} > ./DEVHUB_SFDX_URL.txt'
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: 'sfdx force:auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d'
# Create scratch org
- name: 'Create scratch org'
run: 'sfdx force:org:create -f config/project-scratch-def.json -a scratch-org -s -d 1'
# Deploy source to scratch org
- name: 'Push source to scratch org'
run: 'sfdx force:source:push'
# Housekeeping
- name: 'Delete scratch org'
if: always()
run: 'sfdx force:org:delete -p -u scratch-org'