-
Notifications
You must be signed in to change notification settings - Fork 9
66 lines (60 loc) · 2.04 KB
/
ci.yml
File metadata and controls
66 lines (60 loc) · 2.04 KB
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
# Unique name for this workflow
name: CI
# Definition when the workflow should run
on:
workflow_dispatch:
pull_request:
types: [edited, opened, synchronize, reopened, review_requested]
push:
#branches:
# - main
paths:
- "force-app/**"
- "sample-handler/**"
- "sfdx-project.json"
- "package-lock.json"
- "pmd/**"
# Jobs to be executed
jobs:
format-lint:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
# Checkout the source code
- name: "Checkout source code"
uses: actions/checkout@v6
# 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 for Prettier and Jest
- name: "Install npm dependencies"
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
# Prettier format check
- name: "Code formatting verification with Prettier"
run: npm run prettier:verify
pmd-analysis:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
# Checkout the source code
- name: "Checkout source code"
uses: actions/checkout@v6
# Install PMD
- name: "Install PMD"
run: |
PMD_VERSION=$(curl -s https://api.github.com/repos/pmd/pmd/releases/latest | grep '.tag_name' | sed 's:.*/::' | sed 's:",::')
wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F$PMD_VERSION/pmd-dist-$PMD_VERSION-bin.zip
unzip pmd-dist-$PMD_VERSION-bin.zip -d ~
mv ~/pmd-bin-$PMD_VERSION ~/pmd
~/pmd/bin/pmd --version
# Run PMD scan
- name: "Run PMD scan"
run: ~/pmd/bin/pmd check --dir force-app --dir sample-handler --rulesets pmd/ruleset.xml --format csv --no-cache --verbose --report-file pmd/pmd.csv