-
Notifications
You must be signed in to change notification settings - Fork 41
81 lines (70 loc) · 3.01 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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