Skip to content

doc: fix sample bug #14

doc: fix sample bug

doc: fix sample bug #14

Workflow file for this run

# Unique name for this workflow
name: CI
# Definition when the workflow should run
on:
workflow_dispatch:
push:
branches:
- main
# Jobs to be executed
jobs:
format-lint-test:
runs-on: ubuntu-latest
env:
SALESFORCE_LOGIN_URL: ${{ secrets.SALESFORCE_LOGIN_URL }}
SALESFORCE_USERNAME: ${{ secrets.SALESFORCE_USERNAME }}
SALESFORCE_PASSWORD: ${{ secrets.SALESFORCE_PASSWORD }}
SALESFORCE_TOKEN: ${{ secrets.SALESFORCE_TOKEN }}
SALESFORCE_CLIENT_ID: ${{ secrets.SALESFORCE_CLIENT_ID }}
SALESFORCE_CLIENT_SECRET: ${{ secrets.SALESFORCE_CLIENT_SECRET }}
SALESFORCE_JWT_LOGIN_URL: ${{ secrets.SALESFORCE_JWT_LOGIN_URL }}
SALESFORCE_JWT_CLIENT_ID: ${{ secrets.SALESFORCE_JWT_CLIENT_ID }}
SALESFORCE_PRIVATE_KEY: ${{ secrets.SALESFORCE_PRIVATE_KEY }}
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4
# Install Volta to enforce proper node and package manager versions
- name: 'Install Volta'
uses: volta-cli/action@v4
# Cache node_modules to speed up the process
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v4
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
# Install npm dependencies
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: HUSKY=0 npm ci
# Format
- name: 'Format'
run: npm run format:verify
# Lint
- name: 'Lint'
run: npm run lint
# Configure test env
- name: 'Configure test environment'
run: |
touch .env
echo SALESFORCE_LOGIN_URL=$SALESFORCE_LOGIN_URL >> .env
echo SALESFORCE_USERNAME=$SALESFORCE_USERNAME >> .env
echo SALESFORCE_PASSWORD=$SALESFORCE_PASSWORD >> .env
echo SALESFORCE_TOKEN=$SALESFORCE_TOKEN >> .env
echo SALESFORCE_CLIENT_ID=$SALESFORCE_CLIENT_ID >> .env
echo SALESFORCE_CLIENT_SECRET=$SALESFORCE_CLIENT_SECRET >> .env
echo SALESFORCE_PRIVATE_KEY_PATH=server.key >> .env
echo SALESFORCE_JWT_LOGIN_URL=$SALESFORCE_JWT_LOGIN_URL >> .env
echo SALESFORCE_JWT_CLIENT_ID=$SALESFORCE_JWT_CLIENT_ID >> .env
echo "$SALESFORCE_PRIVATE_KEY" > server.key
# Integration tests
- name: 'Integration tests'
run: npm run test
# Housekeeping
- name: 'Delete test environment configuration'
if: always()
run: rm -f .env server.key