Skip to content

Commit

Permalink
Merge pull request #125 from SFDO-Community-Sprints/feature-issue26
Browse files Browse the repository at this point in the history
Feature issue26
  • Loading branch information
cidarm authored Dec 22, 2023
2 parents 243ebc9 + bdc8ee5 commit 9c6b540
Show file tree
Hide file tree
Showing 29 changed files with 478 additions and 428 deletions.
81 changes: 65 additions & 16 deletions .github/workflows/beta_release.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,89 @@
name: beta release

on:
workflow_dispatch:
push:
branches:
- "main"
- 'main'
paths-ignore:
- "docs/**"
- "README.md"

- 'docs/**'
- 'README.md'
env:
CUMULUSCI_KEYCHAIN_CLASS: cumulusci.core.keychain.EnvironmentProjectKeychain
CUMULUSCI_SERVICE_github: ${{ secrets.CUMULUSCI_SERVICE_GITHUB }}
jobs:
unit_tests:
name: "Run Beta release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install sfdx
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
mkdir sfdx
wget -qO- https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz | tar xJ -C sfdx --strip-components 1
echo $(realpath sfdx/bin) >> $GITHUB_PATH
- name: Authenticate Dev Hub
npm install @salesforce/cli --location=global
nodeInstallPath=$(npm config get prefix)
echo "$nodeInstallPath/bin" >> $GITHUB_PATH
sf --version
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4

# Store secret for dev hub
- name: 'Populate auth file with DEV_HUB_AUTH secret'
shell: bash
run: |
echo ${{ secrets.SFDX_AUTH_URL }} > sfdx_auth
sfdx force:auth:sfdxurl:store -f sfdx_auth -d
# Create package version and extract its id
echo ${{ secrets.DEV_HUB_AUTH}} > ./DEV_HUB_AUTH.txt
secretFileSize=$(wc -c "./DEV_HUB_AUTH.txt" | awk '{print $1}')
if [ $secretFileSize == 1 ]; then
echo "Missing DEV_HUB_AUTH secret. Is this workflow running on a fork?";
exit 1;
fi
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: sf org login sfdx-url -f ./DEV_HUB_AUTH.txt -a devhub -d

# Remove auth file
- name: 'Remove auth file'
run: rm -f ./DEV_HUB_AUTH.txt

#Create Package Version
- name: "Create package version"
id: createPackageVersion
run: |
set +e
json=$(sfdx force:package:version:create -p "Grants Content Kit" --installationkeybypass --definitionfile config/project-scratch-def.json --wait 10 --targetdevhubusername ldodevhub --branch main -c --json)
json=$(sf package version create -p "Grants Content Kit" -x -f config/project-scratch-def.json -w 10 -b main -c --json)
echo $json
status=$(echo $json | jq '.status')
if [ $status == "0" ]; then
packageVersionId=$(echo $json | jq -r '.result.SubscriberPackageVersionId')
echo "::set-output name=packageVersionId::$packageVersionId"
else
echo "sfdx force:package:version:create failed"
echo "sf package creation failed"
fi
exit $status
# Wait for package replication
- name: 'Wait for package replication'
run: sleep 360s

# Create scratch org
- name: 'Create scratch org'
run: sf org create scratch -f config/project-scratch-def.json -a scratch-org -d -y 1
# Install new package in scratch org
- name: 'Install new package version in scratch org'
run: sf package install -p ${{ steps.createPackageVersion.outputs.packageVersionId }} -w 10 -o scratch-org -r

# Install Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
#Install CumulusCI
- name: Install CumulusCI
run: |
python -m pip install -U pip
pip install cumulusci
#Use CCI to deploy and test feature
- name: Generate Release Notes and
run: |
cci flow run gk_release_beta --org feature --delete-org
70 changes: 47 additions & 23 deletions .github/workflows/feature_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,54 @@ on:
- 'README.md'
env:
CUMULUSCI_KEYCHAIN_CLASS: cumulusci.core.keychain.EnvironmentProjectKeychain
CUMULUSCI_SERVICE_github: ${{ secrets.CUMULUSCI_SERVICE_github }}
CUMULUSCI_SERVICE_github: ${{ secrets.CUMULUSCI_SERVICE_GITHUB }}
jobs:
unit_tests:
name: 'Deploy Code and Run Apex Tests'
runs-on: ubuntu-latest
runs-on: Ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install sfdx
run: |
mkdir sfdx
wget -qO- https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz | tar xJ -C sfdx --strip-components 1
echo $(realpath sfdx/bin) >> $GITHUB_PATH
- name: Authenticate Dev Hub
run: |
echo ${{ secrets.SFDX_AUTH_URL }} > sfdx_auth
sfdx force:auth:sfdxurl:store -f sfdx_auth -d
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Install CumulusCI
run: |
python -m pip install -U pip
pip install cumulusci
- name: Deploy and Run Tests
run: |
cci flow run ci_feature --org dev --delete-org
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
npm install @salesforce/cli --location=global
nodeInstallPath=$(npm config get prefix)
echo "$nodeInstallPath/bin" >> $GITHUB_PATH
sf --version
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4

# Store secret for dev hub
- name: 'Populate auth file with DEV_HUB_AUTH secret'
shell: bash
run: |
echo ${{ secrets.DEV_HUB_AUTH}} > ./DEV_HUB_AUTH.txt
secretFileSize=$(wc -c "./DEV_HUB_AUTH.txt" | awk '{print $1}')
if [ $secretFileSize == 1 ]; then
echo "Missing DEV_HUB_AUTH secret. Is this workflow running on a fork?";
exit 1;
fi
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: sf org login sfdx-url -f ./DEV_HUB_AUTH.txt -a devhub -d

# Remove auth file
- name: 'Remove auth file'
run: rm -f ./DEV_HUB_AUTH.txt

# Install Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
#Install CumulusCI
- name: Install CumulusCI
run: |
python -m pip install -U pip
pip install cumulusci
#Use CCI to deploy and test feature
- name: Deploy and Run Tests
run: |
cci flow run ci_feature --org dev --delete-org
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ tempdata
tempdata-out
*.cci/*
.pmdCache
.vscode/*
.vscode/settings.json
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"**/.mvn": true,
"**/.exchange_modules_tmp": true,
".mule": true
}
},
"cSpell.words": [
"onselectedblockchange"
]
}
12 changes: 11 additions & 1 deletion cumulusci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,14 @@ flows:
5:
task: command
options:
command: sfdx data import tree -p test-data/export-section-GGW_Section__c-plan.json
command: sfdx data import tree -p test-data/export-section-GGW_Section__c-plan.json

gk_release_beta:
description: 'Generate Release notes and auto merge main branch.'
steps:
1:
task: github_release
2:
task: github_release_notes
3:
task: github_automerge_main
2 changes: 2 additions & 0 deletions force-app/main/default/classes/GGW_ApplicationCtrl.cls
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ public without sharing class GGW_ApplicationCtrl {
@AuraEnabled
public static GGW_SectionWrapper createNewSection(String name){
GGW_Section__c maxOrder = findMaxOrderSection();
String lang = GGW_Util.getGrantLanguage();
GGW_Section__c s = new GGW_Section__c();
s.Name = name;
s.Recommended__c = true;
s.Suggested__c = true;
s.Language__c = lang;
s.Sort_Order__c = getSectionSortOrder(maxOrder);
if(Schema.sObjectType.GGW_Section__c.isCreateable()){
insert s;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>54.0</apiVersion>
<apiVersion>58.0</apiVersion>
<status>Active</status>
</ApexClass>
4 changes: 2 additions & 2 deletions force-app/main/default/classes/GGW_ContentBlockWrapper.cls
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class GGW_ContentBlockWrapper {
this.languagelabel = GGW_Util.toLanguageLabel(block.Language__c); // Language label
// Count words in rich text with APEX methods
integer words = block.Description__c.normalizeSpace().stripHtmlTags().replaceAll('\\S','').length() ;
this.wordcount = words;
this.displaydate = block.CreatedDate.format('YYYY-MM'); // Format this to short
this.wordcount = words + 1; // Adjust of undercount by 1 noted in Issue #3
this.displaydate = block.CreatedDate.format('YYYY-MM-dd'); // Format this to short
// Temporary value for tag default
//this.displaybadge = ''; // TODO find how to fill this what make a tag?
this.totalblocks = cnt;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<apiVersion>58.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<template>
<lightning-card title={titleAvailableBlocks} icon-name="utility:description">
<!--
<lightning-button label="Save" slot="actions"></lightning-button>
-->
<template if:true={contentblocks}>

<template for:each={contentblocks} for:item="block">

<div key={block.recordid} class="slds-box slds-box_xx-small slds-m-left_xx-small slds-m-right_xxx-small slds-m-bottom_xx-small">
<lightning-card title={block.title}>
<!--
<lightning-input type="checkbox-button" label={block.title} name={block.recordid} slot="actions"></lightning-input>
-->
<lightning-button-stateful
label-when-off="Select"
label-when-on="Selected"
Expand All @@ -26,7 +20,8 @@
>
</lightning-button-stateful>

<lightning-formatted-rich-text
<lightning-formatted-rich-text
class="slds-text-align_left"
value={block.displaytext}
></lightning-formatted-rich-text>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class GgwContentBlockModal extends LightningElement {
// Select a block method
handleSelectClick(evt){
//console.log('### Button event: '+evt.target.name);
//--- MUST do tehse JSON tricks to clone arraye to update data
//--- MUST do these JSON tricks to clone array to update data
// if not get error Cannot assign to read only property
let tmpBlocks = JSON.parse(JSON.stringify(this.contentblocks));
// When selecting block with statefull button ensure all otehrs are DESELECTED Only one allowed selected
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<apiVersion>58.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Ggw content block modal</masterLabel>
<targets>
Expand Down
Loading

0 comments on commit 9c6b540

Please sign in to comment.