ci: add CI workflow for OpenTofu validation and formatting #1
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 | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate: | |
| name: Validate OpenTofu | |
| runs-on: [self-hosted, linux, assignment2] | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Setup OpenTofu | |
| uses: opentofu/setup-opentofu@v2 | |
| with: | |
| tofu_version: "1.12.6" | |
| tofu_wrapper: false | |
| - name: Check formatting | |
| run: tofu fmt -check -recursive | |
| - name: Initialize bootstrap configuration | |
| working-directory: bootstrap | |
| # Skip backend initialization | |
| run: tofu init -backend=false -input=false | |
| - name: Validate bootstrap configuration | |
| working-directory: bootstrap | |
| # Validate without accessing Openstack resources | |
| run: tofu validate -no-color | |