Merge pull request #296 from rustyrazorblade/stress-no-build #6
This file contains hidden or 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
| name: Packer Static Analysis | |
| on: | |
| pull_request: | |
| paths: | |
| - "packer/**" | |
| - ".github/workflows/packer-lint.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "packer/**" | |
| - ".github/workflows/packer-lint.yml" | |
| workflow_dispatch: | |
| jobs: | |
| validate-packer: | |
| name: Validate Packer HCL Files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Packer | |
| uses: hashicorp/setup-packer@main | |
| with: | |
| version: "latest" | |
| - name: Initialize Packer | |
| run: | | |
| cd packer/base | |
| packer init . | |
| cd ../cassandra | |
| packer init . | |
| - name: Validate base.pkr.hcl | |
| run: | | |
| cd packer/base | |
| packer validate . | |
| - name: Validate cassandra.pkr.hcl | |
| run: | | |
| cd packer/cassandra | |
| packer validate . | |
| shellcheck: | |
| name: Lint Shell Scripts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run ShellCheck | |
| uses: ludeeus/action-shellcheck@master | |
| with: | |
| scandir: "./packer" | |
| severity: error | |
| format: gcc | |
| yamllint: | |
| name: Validate YAML Files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install yamllint | |
| run: pip install yamllint | |
| - name: Run yamllint | |
| run: | | |
| # Check if .yamllint.yml exists, use it; otherwise use default config | |
| if [ -f packer/.yamllint.yml ]; then | |
| yamllint -c packer/.yamllint.yml packer/ | |
| else | |
| yamllint packer/ | |
| fi |