|
| 1 | +# Unique name for this workflow |
| 2 | +name: Deployment |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + paths-ignore: |
| 7 | + - 'content/**' |
| 8 | + - 'docs/**' |
| 9 | + - 'examples/**' |
| 10 | + - 'packages/**' |
| 11 | + - '.forceignore' |
| 12 | + - '.gitignore' |
| 13 | + - '.prettierignore' |
| 14 | + - '.prettierrc' |
| 15 | + - 'Contributing.md' |
| 16 | + - 'LICENSE' |
| 17 | + - 'package.json' |
| 18 | + - 'README.md' |
| 19 | + - './**/README.md' |
| 20 | + - 'sfdx-project.json' |
| 21 | + |
| 22 | +jobs: |
| 23 | + scratch-org-tests: |
| 24 | + name: 'Scratch Org Tests' |
| 25 | + runs-on: ubuntu-latest |
| 26 | + environment: Test |
| 27 | + steps: |
| 28 | + # Checkout the code |
| 29 | + - name: 'Checkout source code' |
| 30 | + uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: 'Setup node' |
| 33 | + uses: actions/setup-node@v2 |
| 34 | + with: |
| 35 | + node-version: '14' |
| 36 | + |
| 37 | + - name: 'Install npm' |
| 38 | + run: npm install |
| 39 | + |
| 40 | + # Install Salesforce CLI |
| 41 | + - name: Install Salesforce CLI |
| 42 | + run: | |
| 43 | + wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz |
| 44 | + mkdir sfdx-cli |
| 45 | + tar xJf sfdx-linux-amd64.tar.xz -C sfdx-cli --strip-components 1 |
| 46 | + ./sfdx-cli/install |
| 47 | +
|
| 48 | + # Start remote testing |
| 49 | + |
| 50 | + # Store secrets for dev hubs |
| 51 | + - name: 'Populate DevHub Auth Files' |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + echo ${{ env.JONGPIE_DEVHUB_SFDX_URL }} > ./JONGPIE_DEVHUB_SFDX_URL.txt |
| 55 | + env: |
| 56 | + JONGPIE_DEVHUB_SFDX_URL: ${{ secrets.JONGPIE_DEVHUB_SFDX_URL }} |
| 57 | + |
| 58 | + - name: 'Authorize Dev Hubs' |
| 59 | + run: | |
| 60 | + sfdx auth:sfdxurl:store --sfdxurlfile ./JONGPIE_DEVHUB_SFDX_URL.txt --setalias jongpie-devhub |
| 61 | +
|
| 62 | + - name: 'Create Scratch Org' |
| 63 | + run: sfdx force:org:create --targetdevhubusername jongpie-devhub --definitionfile ./config/enterprise-scratch-def.json --setalias CustomMetadataSaver --setdefaultusername |
| 64 | + |
| 65 | + - name: 'Deploy Metadata' |
| 66 | + run: sfdx force:source:push |
| 67 | + |
| 68 | + - name: Enable improved SFDX code coverage |
| 69 | + run: export SFDX_IMPROVED_CODE_COVERAGE=true |
| 70 | + |
| 71 | + - name: 'Run Apex Tests' |
| 72 | + run: npm run test:apex |
| 73 | + |
| 74 | + # Upload code coverage data for Apex |
| 75 | + # codecov integration is currently disabled due to |
| 76 | + # issues with parsing sfdx codecoverage files |
| 77 | + # - name: 'Upload code coverage for Apex to Codecov.io' |
| 78 | + |
| 79 | + # with: |
| 80 | + # token: ${{ secrets.CODECOV_TOKEN }} |
| 81 | + # flags: Apex |
| 82 | + |
| 83 | + - name: 'Delete Scratch Org' |
| 84 | + run: sfdx force:org:delete --json --noprompt |
| 85 | + if: ${{ always() }} |
0 commit comments