-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/axios-1.7.4
- Loading branch information
Showing
25 changed files
with
815 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "Build and publish artifact" | ||
description: "Build and publish an artifact to github npm registery" | ||
inputs: | ||
nodeToken: | ||
description: "A Github PAT" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: "Authenticate to npm" | ||
uses: actions/setup-node@v4 | ||
with: | ||
registry-url: "https://npm.pkg.github.com" | ||
|
||
- name: "Build package" | ||
shell: bash | ||
run: | | ||
sfp build --devhubalias devhub --diffcheck --buildnumber ${GITHUB_RUN_ID} --branch ${GITHUB_REF#refs/heads/} | ||
- name: "Publish" | ||
shell: bash | ||
run: | | ||
sfp publish --artifactdir artifacts --npm --scope @${{ github.repository_owner }} --gittag --pushgittag | ||
env: | ||
NODE_AUTH_TOKEN: ${{ inputs.nodeToken }} | ||
|
||
- uses: navikt/sf-platform/.github/actions/uploadWorkflowArtifactsAndLogs@main | ||
with: | ||
artifactName: "build-artifacts" | ||
uploadArtifacts: true | ||
logName: "build-logs" | ||
publishLogs: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: "Create Scratch Pool" | ||
description: "Create scratch pools" | ||
inputs: | ||
devhub: | ||
description: "Devhub alias or username" | ||
required: true | ||
poolConfigPath: | ||
description: "Path to the pool config file" | ||
required: true | ||
nodeToken: | ||
description: "A Github PAT" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: "Check Scratch Limits" | ||
shell: bash | ||
run: | | ||
sf org list limits --target-org ${{ inputs.devhub }} --json >> limits.json | ||
remainingDailyScratchOrgs=$(jq '.result[] | select(.name=="DailyScratchOrgs").remaining' limits.json) | ||
remainingActiveScratchOrgs=$(jq '.result[] | select(.name=="ActiveScratchOrgs").remaining' limits.json) | ||
rm limits.json | ||
# If to few remaining daily scratch orgs, exit | ||
if [ $remainingDailyScratchOrgs -lt 15 ] | ||
then | ||
echo "::error title=Close to remaining Daily Scratch Org Limit::Remaining DailyScratchOrgs: $remainingDailyScratchOrgs" | ||
exit 1 | ||
fi | ||
# If to few remaining active scratch orgs, exit | ||
if [ $remainingActiveScratchOrgs -lt 10 ] | ||
then | ||
echo "::error title=Close to remaining Active Scratch Orgs::Remaining ActiveScratchOrgs: $remainingActiveScratchOrgs" | ||
exit 1 | ||
fi | ||
# Authenticate to npm | ||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: "https://npm.pkg.github.com" | ||
|
||
- name: "Prepare a pool of scratch orgs" | ||
continue-on-error: true | ||
shell: bash | ||
run: | | ||
echo "poolTag=$(jq --raw-output '.tag' ${{inputs.poolConfigPath}})" >> $GITHUB_ENV | ||
#Prepare Pool | ||
sfp pool prepare --poolconfig ${{ inputs.poolConfigPath }} --targetdevhubusername ${{ inputs.devhub }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ inputs.nodeToken }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: "Delete Scratch Pool" | ||
description: "Delete scratch pools" | ||
inputs: | ||
devhub: | ||
description: "Devhub alias or username" | ||
required: true | ||
deleteJobType: | ||
description: "Gyldige verdier: allscratchorgs, inprogressonly, orphans, unassigned" | ||
required: true | ||
poolTag: | ||
description: "Taggen til poolet som skal slettes" | ||
required: false | ||
runs: | ||
using: composite | ||
steps: | ||
- name: "Delete Pool" | ||
continue-on-error: true | ||
shell: bash | ||
run: | | ||
poolTag="${{ inputs.poolTag }}" | ||
deleteJobType="${{ inputs.deleteJobType }}" | ||
command="sfp pool delete --targetdevhubusername ${{ inputs.devhub }}" | ||
message="Trying to delete " | ||
if [ -z "$poolTag" ]; then | ||
echo "No tag provided" | ||
else | ||
echo "Run delete jobs on the pool $poolTag" | ||
command+=" --tag $poolTag" | ||
fi | ||
case "$deleteJobType" in | ||
'allscratchorgs') | ||
if [[ -z "$poolTag" || "$poolTag" == "dev" ]]; then | ||
echo "::error title=Cannot delete all scratch orgs::Cannot delete all scratch orgs in dev pool through action. This must be done manually" | ||
exit 1 | ||
fi | ||
message+="all scratch orgs." | ||
command+=" --allscratchorgs" | ||
;; | ||
'inprogressonly') | ||
message+="in progress scratch orgs." | ||
command+=" --inprogressonly" | ||
;; | ||
'orphans') | ||
message+="orphaned scratch orgs." | ||
command+=" --orphans" | ||
;; | ||
'unassigned') | ||
echo "unnassigned scratch orgs." | ||
;; | ||
*) | ||
echo "::error title=Missing input::deleteJobType did not match any of the legal input values. deleteJobType => $deleteJobType" | ||
exit 1 | ||
esac | ||
echo $command | ||
eval $command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "Quick Build" | ||
description: "Build and publish an artifact to github npm registery" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: "Quickbuild package" | ||
id: quickbuildPackage | ||
shell: bash | ||
run: | | ||
sfp quickbuild --devhubalias devhub --diffcheck --buildnumber ${GITHUB_RUN_ID} --branch ${GITHUB_REF#refs/heads/} | ||
- uses: navikt/sf-platform/.github/actions/uploadWorkflowArtifactsAndLogs@main | ||
with: | ||
artifactName: "quick-build-artifacts" | ||
uploadArtifacts: true | ||
logName: "quick-build-logs" | ||
publishLogs: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "Prettier Check" | ||
description: "Run Prettier on the code" | ||
inputs: | ||
pathToValidate: | ||
description: "The path to the files we want to validate" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Print inputs | ||
shell: bash | ||
run: | | ||
echo "Path to validate: ${{ inputs.pathToValidate }}" | ||
- name: Eslint Check | ||
shell: bash | ||
run: | | ||
npx eslint --no-error-on-unmatched-pattern ${{ inputs.pathToValidate }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "Prettier Check" | ||
description: "Run Prettier on the code" | ||
inputs: | ||
pathToValidate: | ||
description: "The path to the files we want to validate" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Print inputs | ||
shell: bash | ||
run: | | ||
echo "Path to validate: ${{ inputs.pathToValidate }}" | ||
- name: Prettier Check | ||
shell: bash | ||
run: | | ||
npx eslint --no-error-on-unmatched-pattern ${{ inputs.pathToValidate }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "Run Salesforce Code Scanner" | ||
description: "Run Prettier on the code" | ||
inputs: | ||
pathToValidate: | ||
description: "The path to the files we want to validate" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Print inputs | ||
shell: bash | ||
run: | | ||
echo "Path to validate: ${{ inputs.pathToValidate }}" | ||
- name: Check if sf cli and code analyzer is installed | ||
id: checkInstallationStatus | ||
shell: bash | ||
run: | | ||
needToInstallSfCli=false | ||
needToInstallSfCodeAnalyzer=false | ||
package='@salesforce/cli' | ||
plugin='@salesforce/sfdx-scanner' | ||
if [ `npm list -g | grep -c $package` -eq 0 ]; then | ||
echo $package is not installed | ||
needToInstallSfCli=true | ||
elif [ `sf plugins | grep -c $plugin` -eq 0 ]; then | ||
echo $package is installed, need to install $plugin. | ||
needToInstallSfCodeAnalyzer=true | ||
else | ||
echo $package and $plugin is installed. | ||
fi | ||
echo "needToInstallSfCli=$needToInstallSfCli" >> $GITHUB_OUTPUT | ||
echo "needToInstallSfCodeAnalyzer=$needToInstallSfCodeAnalyzer" >> $GITHUB_OUTPUT | ||
- id: installSfCli | ||
if: ${{ steps.checkInstallationStatus.outputs.needToInstallSfCli }} | ||
uses: navikt/crm-workflows-base/.github/actions/installSF@master | ||
|
||
- id: installSfCodeAnalyzer | ||
if: ${{ steps.checkInstallationStatus.outputs.needToInstallSfCodeAnalyzer }} | ||
shell: bash | ||
run: | | ||
sf plugins install @salesforce/sfdx-scanner | ||
- name: Run Salesforce Code Analyzer | ||
id: run-code-analyzer | ||
uses: forcedotcom/run-code-analyzer@v1 | ||
with: | ||
run-command: run | ||
run-arguments: --normalize-severity --outfile results.html --target ${{ inputs.pathToValidate }} | ||
results-artifact-name: salesforce-code-analyzer-results | ||
|
||
- name: Check the Salesforce Code Analyzer outputs to determine whether to fail | ||
shell: bash | ||
if: | | ||
steps.run-code-analyzer.outputs.exit-code > 0 || | ||
steps.run-code-analyzer.outputs.num-sev1-violations > 0 || | ||
steps.run-code-analyzer.outputs.num-violations > 10 | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: "Upload workflow artifacts and logs" | ||
description: "Uploads logs and sfp generated artifacts to the workflow" | ||
inputs: | ||
artifactName: | ||
description: "Name of the artifact" | ||
required: true | ||
uploadArtifacts: | ||
description: "If true upload the artifacts" | ||
required: true | ||
logName: | ||
description: "Name of the logs" | ||
required: true | ||
publishLogs: | ||
description: "If true upload the flxbl logs" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: "Publish artifacts" | ||
if: ${{ inputs.uploadArtifacts }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.artifactName }} | ||
path: artifacts | ||
retention-days: 10 | ||
|
||
# Upload Flxbl logs | ||
- name: "Publish logs" | ||
if: ${{ inputs.publishLogs }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "${{ inputs.logName }}" | ||
path: .sfpowerscripts | ||
if-no-files-found: ignore | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: "Build" | ||
on: | ||
workflow_call: | ||
secrets: | ||
SF_DEVHUB_URL: | ||
required: true | ||
workflow_run: | ||
workflows: ["ciQuickBuild"] | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/flxbl-io/sfp:latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: navikt/crm-workflows-base/.github/actions/authenticateOrg@master | ||
with: | ||
auth-url: ${{ secrets.SF_DEVHUB_URL }} | ||
alias: devhub | ||
setDefaultDevhubUsername: true | ||
|
||
- uses: navikt/sf-platform/.github/actions/ciBuildAndPublishArtifact@main | ||
with: | ||
nodeToken: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.