|
44 | 44 | java-version: "21" |
45 | 45 | distribution: "corretto" |
46 | 46 |
|
47 | | - - name: Checkout code |
| 47 | + - &checkout |
| 48 | + name: Checkout code |
48 | 49 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
49 | 50 | with: |
50 | 51 | ref: ${{ env.BRANCH_NAME }} |
@@ -83,49 +84,50 @@ jobs: |
83 | 84 | git-secrets --scan-history . |
84 | 85 |
|
85 | 86 | # using git commit sha for version of action to ensure we have stable version |
86 | | - - name: Install asdf |
| 87 | + - &install_asdf |
| 88 | + name: Install asdf |
87 | 89 | uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47 |
88 | 90 | with: |
89 | 91 | asdf_version: ${{ inputs.asdfVersion }} |
90 | 92 |
|
91 | | - - name: Cache asdf |
| 93 | + - &cache_asdf |
| 94 | + name: Cache asdf |
92 | 95 | uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb |
93 | 96 | with: |
94 | | - path: | |
95 | | - ~/.asdf |
| 97 | + path: ~/.asdf |
96 | 98 | key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }} |
97 | | - restore-keys: | |
98 | | - ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }} |
99 | 99 |
|
100 | | - - name: Install asdf dependencies in .tool-versions |
| 100 | + - &install_asdf_deps |
| 101 | + name: Install asdf dependencies in .tool-versions |
101 | 102 | uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47 |
102 | 103 | with: |
103 | 104 | asdf_version: ${{ inputs.asdfVersion }} |
104 | 105 | env: |
105 | 106 | PYTHON_CONFIGURE_OPTS: --enable-shared |
106 | 107 |
|
107 | | - - name: Reinstall poetry |
| 108 | + - &reinstall_poetry |
| 109 | + name: Reinstall poetry |
108 | 110 | if: ${{ inputs.reinstall_poetry }} |
109 | 111 | run: | |
110 | 112 | poetry_tool_version=$(cat .tool-versions | grep poetry) |
111 | 113 | poetry_version=${poetry_tool_version//"poetry "} |
112 | 114 | asdf uninstall poetry "$poetry_version" |
113 | 115 | asdf install poetry |
114 | 116 |
|
115 | | - - name: Setting up .npmrc |
| 117 | + - &setup_npmrc |
| 118 | + name: Setting up .npmrc |
116 | 119 | env: |
117 | 120 | NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
118 | 121 | run: | |
119 | 122 | echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc |
120 | 123 | echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc |
121 | 124 |
|
122 | | - - name: Cache npm dependencies |
| 125 | + - &cache_npm |
| 126 | + name: Cache npm dependencies |
123 | 127 | uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb |
124 | 128 | with: |
125 | 129 | path: ./node_modules |
126 | 130 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
127 | | - restore-keys: | |
128 | | - ${{ runner.os }}-node- |
129 | 131 |
|
130 | 132 | - name: make install |
131 | 133 | run: | |
@@ -233,9 +235,6 @@ jobs: |
233 | 235 | - name: Run code lint |
234 | 236 | run: make lint |
235 | 237 |
|
236 | | - - name: actionlint |
237 | | - uses: raven-actions/actionlint@e01d1ea33dd6a5ed517d95b4c0c357560ac6f518 |
238 | | - |
239 | 238 | - name: Run ShellCheck |
240 | 239 | uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 |
241 | 240 | with: |
@@ -510,41 +509,11 @@ jobs: |
510 | 509 | IaC-validation: |
511 | 510 | runs-on: ubuntu-22.04 |
512 | 511 | steps: |
513 | | - - name: Checkout code |
514 | | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
515 | | - with: |
516 | | - ref: ${{ env.BRANCH_NAME }} |
517 | | - fetch-depth: 0 |
518 | | - |
519 | | - # using git commit sha for version of action to ensure we have stable version |
520 | | - - name: Install asdf |
521 | | - uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47 |
522 | | - with: |
523 | | - asdf_version: ${{ inputs.asdfVersion }} |
524 | | - |
525 | | - - name: Cache asdf |
526 | | - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb |
527 | | - with: |
528 | | - path: | |
529 | | - ~/.asdf |
530 | | - key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }} |
531 | | - restore-keys: | |
532 | | - ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }} |
533 | | -
|
534 | | - - name: Install asdf dependencies in .tool-versions |
535 | | - uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47 |
536 | | - with: |
537 | | - asdf_version: ${{ inputs.asdfVersion }} |
538 | | - env: |
539 | | - PYTHON_CONFIGURE_OPTS: --enable-shared |
540 | | - |
541 | | - - name: Reinstall poetry |
542 | | - if: ${{ inputs.reinstall_poetry }} |
543 | | - run: | |
544 | | - poetry_tool_version=$(cat .tool-versions | grep poetry) |
545 | | - poetry_version=${poetry_tool_version//"poetry "} |
546 | | - asdf uninstall poetry "$poetry_version" |
547 | | - asdf install poetry |
| 512 | + - *checkout |
| 513 | + - *install_asdf |
| 514 | + - *cache_asdf |
| 515 | + - *install_asdf_deps |
| 516 | + - *reinstall_poetry |
548 | 517 |
|
549 | 518 | - name: Check for SAM templates |
550 | 519 | id: check_sam_templates |
@@ -598,22 +567,8 @@ jobs: |
598 | 567 | cfn-lint -I "cloudformation/**/*.y*ml" 2>&1 | awk '/Run scan/ { print } /^[EW][0-9]/ { print; getline; print }' |
599 | 568 | cfn-lint -I "SAMtemplates/**/*.y*ml" 2>&1 | awk '/Run scan/ { print } /^[EW][0-9]/ { print; getline; print }' |
600 | 569 |
|
601 | | - - name: Cache npm dependencies |
602 | | - if: steps.check_cdk.outputs.cdk_exists == 'true' |
603 | | - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb |
604 | | - with: |
605 | | - path: ~/.npm |
606 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
607 | | - restore-keys: | |
608 | | - ${{ runner.os }}-node- |
609 | | -
|
610 | | - - name: Setting up .npmrc |
611 | | - if: steps.check_cdk.outputs.cdk_exists == 'true' |
612 | | - env: |
613 | | - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
614 | | - run: | |
615 | | - echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc |
616 | | - echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc |
| 570 | + - *cache_npm |
| 571 | + - *setup_npmrc |
617 | 572 |
|
618 | 573 | - name: make install NodeJS |
619 | 574 | if: steps.check_cdk.outputs.cdk_exists == 'true' |
|
0 commit comments