|
| 1 | +--- |
| 2 | +name: Test on push and pull request |
| 3 | + |
| 4 | +permissions: |
| 5 | + actions: write |
| 6 | + contents: read |
| 7 | + packages: write |
| 8 | + # To report GitHub Actions status checks |
| 9 | + statuses: write |
| 10 | + id-token: write |
| 11 | + |
| 12 | +on: |
| 13 | + push: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + pull_request: |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }} # to branch/PR + OS |
| 20 | + cancel-in-progress: true |
| 21 | + |
| 22 | +jobs: |
| 23 | + lint: |
| 24 | + name: Lint |
| 25 | + uses: ./.github/workflows/lint.yml |
| 26 | + |
| 27 | + files_changed: |
| 28 | + name: Determine files changed |
| 29 | + needs: lint |
| 30 | + # continue-on-error: true # Uncomment once integration is finished |
| 31 | + runs-on: ubuntu-latest |
| 32 | + # Map a step output to a job output |
| 33 | + outputs: |
| 34 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 35 | + paths_result: ${{ steps.skip_check.outputs.paths_result }} |
| 36 | + steps: |
| 37 | + - id: skip_check |
| 38 | + # For security we use the commit of fkirc/skip-duplicate-actions@v5 |
| 39 | + uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf |
| 40 | + with: |
| 41 | + cancel_others: true |
| 42 | + paths_filter: | |
| 43 | + extra: |
| 44 | + paths: |
| 45 | + - 'environments/.stackhpc/tofu/cluster_image.auto.tfvars.json' |
| 46 | + - 'ansible/roles/doca/**' |
| 47 | + - 'ansible/roles/cuda/**' |
| 48 | + - 'ansible/roles/lustre/**' |
| 49 | + - '.github/workflows/extra.yml' |
| 50 | + stackhpc: |
| 51 | + paths: |
| 52 | + - '**' |
| 53 | + - '!dev/**' |
| 54 | + - 'dev/setup-env.sh' |
| 55 | + - '!docs/**' |
| 56 | + - '!README.md' |
| 57 | + - '!.gitignore' |
| 58 | + - '!.github/workflows/' |
| 59 | + - '.github/workflows/stackhpc' |
| 60 | + trivvyscan: |
| 61 | + paths: |
| 62 | + - 'environments/.stackhpc/tofu/cluster_image.auto.tfvars.json' |
| 63 | +
|
| 64 | + extra: |
| 65 | + name: Test extra build |
| 66 | + needs: files_changed |
| 67 | + if: needs.files_changed.outputs.should_skip != 'true' && |
| 68 | + !fromJSON(needs.files_changed.outputs.paths_result).extra.should_skip |
| 69 | + #uses: ./.github/workflows/extra.yml |
| 70 | + steps: # TEST |
| 71 | + - run: echo "Running: Test extra build..." && sleep 30 # TEST |
| 72 | + runs-on: ubuntu-latest # TEST |
| 73 | + #secrets: inherit |
| 74 | + |
| 75 | + stackhpc: |
| 76 | + name: Test deployment and reimage on OpenStack |
| 77 | + needs: files_changed |
| 78 | + if: needs.files_changed.outputs.should_skip != 'true' && |
| 79 | + !fromJSON(needs.files_changed.outputs.paths_result).stackhpc.should_skip |
| 80 | + #uses: ./.github/workflows/stackhpc.yml |
| 81 | + steps: # TEST |
| 82 | + - run: echo "Running: Test deployment and reimage on OpenStack..." && sleep 30 # TEST |
| 83 | + runs-on: ubuntu-latest # TEST |
| 84 | + #secrets: inherit |
| 85 | + |
| 86 | + trivvyscan: |
| 87 | + name: Trivy scan image for vulnerabilities |
| 88 | + needs: files_changed |
| 89 | + if: github.event_name == 'pull_request' && |
| 90 | + needs.files_changed.outputs.should_skip != 'true' && |
| 91 | + !fromJSON(needs.files_changed.outputs.paths_result).trivvyscan.should_skip |
| 92 | + #uses: ./.github/workflows/trivvyscan.yml |
| 93 | + steps: # TEST |
| 94 | + - run: echo "Running: Trivy scan image for vulnerabilities..." && sleep 30 # TEST |
| 95 | + runs-on: ubuntu-latest # TEST |
| 96 | + #secrets: inherit |
0 commit comments