CI #1346
This file contains 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: | |
- trunk | |
pull_request: | |
branches: | |
- trunk | |
schedule: | |
- cron: "0 0 * * TUE" | |
jobs: | |
terraform: | |
name: Lint and format terraform | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: ubuntu-latest | |
# https://www.terraform.io/docs/github-actions/getting-started.html | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.2.2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | |
with: | |
aws-region: us-west-2 | |
role-to-assume: arn:aws:iam::447522982029:role/gha-tf-lint-artichoke-s3-ro-20241019065142842900000002 | |
role-session-name: GitHubActionsSession@ci-terraform | |
- name: Show AWS caller identity | |
run: aws sts get-caller-identity | |
- name: "Setup Terraform" | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
with: | |
terraform_version: 1.x | |
- name: "Format terraform sources" | |
run: terraform fmt -recursive -check -diff | |
- name: "Initialize aws environment" | |
run: terraform -chdir=aws init | |
- name: "Validate aws environment" | |
run: terraform -chdir=aws validate -no-color | |
- name: "Initialize github-org-artichoke environment" | |
run: terraform -chdir=github-org-artichoke init | |
- name: "Validate github-org-artichoke environment" | |
run: terraform -chdir=github-org-artichoke validate -no-color | |
- name: "Initialize github-org-artichokeruby environment" | |
run: terraform -chdir=github-org-artichokeruby init | |
- name: "Validate github-org-artichokeruby environment" | |
run: terraform -chdir=github-org-artichokeruby validate -no-color | |
- name: "Initialize github-org-artichoke-ruby environment" | |
run: terraform -chdir=github-org-artichoke-ruby init | |
- name: "Validate github-org-artichoke-ruby environment" | |
run: terraform -chdir=github-org-artichoke-ruby validate -no-color | |
- name: "Init and validate github-actions-oidc-provider project" | |
run: | | |
terraform -chdir=terraform/projects/github-actions-oidc-provider init | |
terraform -chdir=terraform/projects/github-actions-oidc-provider validate -no-color | |
- name: "Init and validate github-actions-terraform-linting project" | |
run: | | |
terraform -chdir=terraform/projects/github-actions-terraform-linting init | |
terraform -chdir=terraform/projects/github-actions-terraform-linting validate -no-color | |
- name: "Init and validate remote-state project" | |
run: | | |
terraform -chdir=terraform/projects/remote-state init | |
terraform -chdir=terraform/projects/remote-state validate -no-color | |
ruby: | |
name: Lint and format Ruby | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.2.2 | |
- name: Install Ruby toolchain | |
uses: ruby/setup-ruby@7d3497fd78c07c0d84ebafa58d8dac60cd1f0763 # v1.199.0 | |
with: | |
ruby-version: ".ruby-version" | |
bundler-cache: true | |
- name: Lint and check formatting with Rubocop | |
run: bundle exec rubocop --format github | |
text: | |
name: Lint and format text | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.2.2 | |
- name: Setup Node.js runtime | |
uses: actions/setup-node@v4.1.0 | |
with: | |
node-version: "lts/*" | |
- name: Install Nodejs toolchain | |
run: npm ci | |
- name: Lint and check formatting with prettier | |
run: npx prettier --check '**/*' | |
- name: Lint YAML sources with yamllint | |
run: | | |
yamllint --version | |
echo "Linting YAML sources with yamllint ..." | |
yamllint --strict --format github . | |
echo "OK" |