fix(cloud-init): preserve frontend template line endings #24
Workflow file for this run
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: CI | |
| # Run validation whenever changes are proposed or merged into main. | |
| # Manual execution is also supported through GitHub Actions. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| # Prevent redundant CI runs for the same branch or pull request. | |
| # Only superseded pull request runs are cancelled, ensuring that | |
| # every commit pushed to main can complete its validation. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| # CI only needs to read repository contents. | |
| # Infrastructure deployment permissions are handled separately. | |
| permissions: | |
| contents: read | |
| jobs: | |
| check: | |
| name: Format and validate infrastructure | |
| runs-on: [self-hosted, linux, assignment2] | |
| timeout-minutes: 30 | |
| steps: | |
| # Retrieve the repository without persisting Git credentials. | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| # Install a consistent OpenTofu version across CI runs. | |
| - name: Setup OpenTofu | |
| uses: opentofu/setup-opentofu@v2 | |
| with: | |
| tofu_version: "1.12.6" | |
| tofu_wrapper: false | |
| # Enforce consistent formatting across all OpenTofu configurations | |
| - name: Check formatting | |
| run: tofu fmt -check -recursive | |
| # Initialize providers and modules without connecting to remote state. | |
| # The committed lock file ensures consistent provider versions. | |
| # Validation checks configuration correctness without deploying resources. | |
| - name: Validate bootstrap | |
| working-directory: bootstrap | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Validate the TEST network stack independently of other stacks. | |
| - name: Validate TEST network | |
| working-directory: environments/test/network | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Validate the TEST frontend stack without requiring deployed infrastructure. | |
| - name: Validate TEST frontend | |
| working-directory: environments/test/frontend | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Validate the STAGE network stack. | |
| - name: Validate STAGE network | |
| working-directory: environments/stage/network | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Validate the STAGE frontend stack. | |
| - name: Validate STAGE frontend | |
| working-directory: environments/stage/frontend | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Validate the PROD network stack. | |
| - name: Validate PROD network | |
| working-directory: environments/prod/network | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Validate the PROD frontend stack. | |
| - name: Validate PROD frontend | |
| working-directory: environments/prod/frontend | |
| run: | | |
| tofu init -backend=false -input=false -lockfile=readonly | |
| tofu validate -no-color | |
| # Install a pinned TFLint version for static code analysis. | |
| - name: Setup TFLint | |
| uses: terraform-linters/setup-tflint@v6 | |
| with: | |
| tflint_version: v0.64.0 | |
| # Inspect all OpenTofu root modules and reusable modules. | |
| # Use the shared configuration from the repository root. | |
| - name: Run TFLint | |
| run: | | |
| tflint --init --config="$GITHUB_WORKSPACE/.tflint.hcl" | |
| tflint --recursive --config="$GITHUB_WORKSPACE/.tflint.hcl" --format=compact | |
| # Install Checkov in an isolated Python environment. | |
| - name: Install Checkov | |
| run: | | |
| python3 -m venv "$RUNNER_TEMP/checkov-venv" | |
| "$RUNNER_TEMP/checkov-venv/bin/python" -m pip install "checkov==3.4.0" | |
| # Scan OpenTofu configurations and GitHub Actions workflows. | |
| - name: Run Checkov | |
| run: | | |
| "$RUNNER_TEMP/checkov-venv/bin/checkov" \ | |
| --directory . \ | |
| --framework terraform,github_actions \ | |
| --skip-path '\.terraform/' \ | |
| --quiet | |