Add codegen for Asset Account Stack CFN and TF #122
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: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| jobs: | |
| meta: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tf-modules: ${{ steps.meta.outputs.tf-modules }} | |
| tf-examples: ${{ steps.meta.outputs.tf-examples }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/collect-meta | |
| id: meta | |
| typos: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: crate-ci/typos@v1.30.2 | |
| terraform-fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: hashicorp/setup-terraform@v1 | |
| with: | |
| terraform_version: ^1 | |
| terraform_wrapper: false | |
| - run: terraform fmt -check | |
| terraform-validate: | |
| runs-on: ubuntu-latest | |
| needs: [meta] | |
| strategy: | |
| matrix: | |
| terraform_example: ${{fromJson(needs.meta.outputs.tf-examples)}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: hashicorp/setup-terraform@v1 | |
| with: | |
| terraform_version: ^1 | |
| terraform_wrapper: false | |
| - run: terraform init -input=false | |
| working-directory: ${{ matrix.terraform_example }} | |
| - run: terraform validate | |
| working-directory: ${{ matrix.terraform_example }} | |
| terraform-docs: | |
| runs-on: ubuntu-latest | |
| needs: [meta] | |
| strategy: | |
| matrix: | |
| terraform_module: ${{fromJson(needs.meta.outputs.tf-modules)}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - run: npm ci --ignore-scripts | |
| - run: | | |
| curl https://github.com/terraform-docs/terraform-docs/releases/download/v0.19.0/terraform-docs-v0.19.0-linux-amd64.tar.gz \ | |
| --location \ | |
| --silent \ | |
| --retry 5 \ | |
| --retry-all-errors \ | |
| --show-error \ | |
| | tar -xz terraform-docs > ./terraform-docs | |
| working-directory: ${{ matrix.terraform_module }} | |
| - run: chmod +x ./terraform-docs | |
| working-directory: ${{ matrix.terraform_module }} | |
| - run: ./terraform-docs markdown . --output-file README.md | |
| working-directory: ${{ matrix.terraform_module }} | |
| # Apply prettier to the generated docs before we check the diff | |
| - run: npx prettier -w . | |
| - run: >- | |
| git diff --exit-code --color=always || ( echo "Terraform docs are | |
| out-of-date. See the diff above." && exit 1 ) | |
| tflint: | |
| runs-on: ubuntu-latest | |
| env: | |
| TFLINT_CONFIG_FILE: "${{ github.workspace }}/.tflint.hcl" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.tflint.d/plugins | |
| key: tflint-${{ runner.os }}-${{ hashFiles('.tflint.hcl') }} | |
| - uses: terraform-linters/setup-tflint@v4 | |
| with: | |
| tflint_version: "latest" | |
| - run: tflint --init | |
| - run: tflint --color --recursive | |
| prettier: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - run: npm ci --ignore-scripts | |
| - run: npx prettier --check . | |
| codegen-freshness: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - run: npm ci --ignore-scripts | |
| - run: cd codegen && npm ci --ignore-scripts | |
| - run: npm run codegen | |
| - run: >- | |
| git diff --exit-code --color=always || ( echo "Generated code is | |
| out-of-date. See the diff above." && exit 1 ) |