Skip to content

Commit

Permalink
Setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Apr 7, 2020
1 parent 092265a commit d781ca9
Show file tree
Hide file tree
Showing 101 changed files with 14,240 additions and 2,791 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
**/lwc/**/*.json
**/lwc/**/*.svg
**/lwc/**/*.xml
**/uuid.js
.sfdx
110 changes: 110 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
branches: [master]

jobs:
formatting-and-linting:
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 install

# Prettier formatting
- name: 'Code formatting verification with Prettier'
run: npm run prettier:verify

# ESlint
- name: 'Lint Lightning Web Components'
run: npm run lint:lwc

# Install PMD
- name: Install PMD
run: wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.22.0/pmd-bin-6.22.0.zip && unzip pmd-bin-6.22.0.zip

# Execute PMD
- name: Execute PMD
run: pmd-bin-6.22.0/bin/run.sh pmd -minimumpriority 2 -d force-app -R apex-ruleset.xml -f text -l apex

scratch-org-test:
runs-on: ubuntu-latest
steps:
# Install Salesforce CLI
- name: Install Salesforce CLI
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
mkdir sfdx-cli
tar xJf sfdx-linux-amd64.tar.xz -C sfdx-cli --strip-components 1
./sfdx-cli/install
# 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 install

# Checkout the code in the pull request
- name: Checkout
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'

# Run Apex tests in scratch org
#- name: 'Run Apex tests'
# run: 'sfdx force:apex:test:run -c -r human -d ./tests/apex -t lwcc -w 20'

# Unit tests
#- name: 'Unit test Lightning Web Components'
# run: npm run test:unit:coverage

# Housekeeping
- name: 'Delete scratch org'
if: always()
run: 'sfdx force:org:delete -p -u scratch-org'
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ mm.log
*.sfuo
.tern-project
TestCache.xml
TestsResultsCache.xml
TestsResultsCache.xml

tests/
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# More information: https://prettier.io/docs/en/ignore.html
#

**/staticresources/**
.localdevserver
.sfdx

coverage/
coverage/
.vscode
20 changes: 11 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"trailingComma": "none",
"singleQuote": true,
"tabWidth": 2,
"overrides": [
{
"files": "**/lwc/**/*.html",
"options": { "parser": "lwc" }
},
{
"files": "*.{cmp,page,component}",
"options": { "parser": "html" }
}
{
"files": "**/lwc/**/*.html",
"options": { "parser": "lwc" }
},
{
"files": "*.{cmp,page,component}",
"options": { "parser": "html" }
}
]
}
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# LWCC

Lightning Web Chartjs Component

# Salesforce App

This guide helps Salesforce developers who are new to Visual Studio Code go from zero to a deployed app using Salesforce Extensions for VS Code and Salesforce CLI.
Expand All @@ -14,7 +16,7 @@ The package development model allows you to create self-contained applications o

If you are starting a new project, we recommend that you consider the package development model. To start developing with this model in Visual Studio Code, see [Package Development Model with VS Code](https://forcedotcom.github.io/salesforcedx-vscode/articles/user-guide/package-development-model). For details about the model, see the [Package Development Model](https://trailhead.salesforce.com/en/content/learn/modules/sfdx_dev_model) Trailhead module.

If you are developing against scratch orgs, use the command `SFDX: Create Project` (VS Code) or `sfdx force:project:create` (Salesforce CLI) to create your project. If you used another command, you might want to start over with that command.
If you are developing against scratch orgs, use the command `SFDX: Create Project` (VS Code) or `sfdx force:project:create` (Salesforce CLI) to create your project. If you used another command, you might want to start over with that command.

When working with source-tracked orgs, use the commands `SFDX: Push Source to Org` (VS Code) or `sfdx force:source:push` (Salesforce CLI) and `SFDX: Pull Source from Org` (VS Code) or `sfdx force:source:pull` (Salesforce CLI). Do not use the `Retrieve` and `Deploy` commands with scratch orgs.

Expand Down Expand Up @@ -57,4 +59,4 @@ For details about developing against orgs that don’t have source tracking, see

Don’t deploy your code to production directly from Visual Studio Code. The deploy and retrieve commands do not support transactional operations, which means that a deployment can fail in a partial state. Also, the deploy and retrieve commands don’t run the tests needed for production deployments. The push and pull commands are disabled for orgs that don’t have source tracking, including production orgs.

Deploy your changes to production using [packaging](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp.htm) or by [converting your source](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_convert) into metadata format and using the [metadata deploy command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm#cli_reference_deploy).
Deploy your changes to production using [packaging](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp.htm) or by [converting your source](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_convert) into metadata format and using the [metadata deploy command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm#cli_reference_deploy).
Loading

0 comments on commit d781ca9

Please sign in to comment.