Skip to content

feat(iac): add TEST environment infrastructure #4

feat(iac): add TEST environment infrastructure

feat(iac): add TEST environment infrastructure #4

Workflow file for this run

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 }}
# Only cancel superseded pull request runs.
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