Skip to content

infraweave-io/actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Github Actions πŸš€

This repository contains ready-to-use actions for your pipelines.

Examples ✨

Below are some example on how they can be used:

How to test a module πŸ§ͺ

This example expects the following structure:

.
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── test.yaml
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ main.tf
β”‚   β”œβ”€β”€ module.yaml
β”‚   β”œβ”€β”€ outputs.tf
β”‚   └── variables.tf
└── tests
    β”œβ”€β”€ test1-something.py
    β”œβ”€β”€ test2-othercheck.py
    └── test3-thirdcheck.py

See example of a test file here: https://preview.infraweave.io/python/#example

This will:

  • lint the terraform code
  • if it passes; find all python files in the tests folder and run them in parallel
# Filename: ./github/workflows/test.yaml

name: Test Module

on: push

permissions:
  id-token: write # for OIDC
  contents: read

jobs:
  terraform-lint-validate:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
      - name: Set Up Terraform
        uses: hashicorp/setup-terraform@v2
        with:
          terraform_version: '1.5.7'
      - name: Install TFLint
        run: |
          curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
      - name: Run TFLint
        run: tflint --chdir "./src"
      - name: Terraform Validate
        run: |
          terraform -chdir="./src" init
          terraform -chdir="./src" validate

  run-tests:
    needs: terraform-lint-validate
    uses: infraweave-io/actions/.github/workflows/test-module.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
    with:
      central_account_id: "000000000000" # Modify this (recommended to use a variable)
      workload_account_id: "111111111111" # Modify this (recommended to use a variable)
      environment: "dev"
      identifier: ${{ github.sha }}

How to publish a module πŸ“¦

This example expects the following structure:

.
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── publish-module.yaml
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ main.tf
β”‚   β”œβ”€β”€ module.yaml
β”‚   β”œβ”€β”€ outputs.tf
β”‚   └── variables.tf
...

This will:

  • publish an InfraWeave module with the desired version
# Filename: ./github/workflows/publish-module.yaml

name: Publish Module

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to publish'
        required: true
        type: string
        default: 0.0.1-dev+some-branch-replace-me

permissions:
  id-token: write # for OIDC
  contents: read

jobs:
  publish-module-dev:
    uses: infraweave-io/actions/.github/workflows/publish-module.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
    with:
      central_account_id: "000000000000" # Modify this (recommended to use a variable)
      environment: "dev"
      version: ${{ inputs.version }}

How to publish a stack πŸ—οΈ

This example expects the following structure:

.
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── publish-stack.yaml
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ claim-bucket.yaml
β”‚   β”œβ”€β”€ claim-ec2.yaml
β”‚   β”œβ”€β”€ claim-s3.yaml
β”‚   └── stack.yaml
...

This will:

  • publish an InfraWeave stack with the desired version
# Filename: ./github/workflows/publish-stack.yaml

name: Publish Stack

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to publish'
        required: true
        type: string
        default: 0.0.1-dev+some-branch-replace-me

permissions:
  id-token: write # for OIDC
  contents: read

jobs:
  publish-module-dev:
    uses: infraweave-io/actions/.github/workflows/publish-stack.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
    with:
      central_account_id: "000000000000" # Modify this (recommended to use a variable)
      environment: "dev"
      version: ${{ inputs.version }}

How to test a stack πŸ§ͺ

This example expects the following structure:

.
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── test.yaml
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ s3bucket.yaml
β”‚   β”œβ”€β”€ stack.yaml
β”‚   β”œβ”€β”€ ec2.yaml
└── tests
    β”œβ”€β”€ test1-something.py
    β”œβ”€β”€ test2-othercheck.py
    └── test3-thirdcheck.py

See example of a test file here: https://preview.infraweave.io/python/#example

This will:

  • find all python files in the tests folder and run them in parallel
# Filename: ./github/workflows/test.yaml

name: Test Stack

on: push

permissions:
  id-token: write # for OIDC
  contents: read

jobs:
  checkout:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

  run-tests:
    needs: checkout
    uses: infraweave-io/actions/.github/workflows/test-stack.yaml@8ba76f33d2f2f41a2e37e4c547390b31325e0567 # v0.0.85
    with:
      central_account_id: "000000000000" # Modify this (recommended to use a variable)
      workload_account_id: "111111111111" # Modify this (recommended to use a variable)
      environment: "dev"
      identifier: ${{ github.sha }}

About

This repository is a collection of ready-to-use GitHub Actions designed to streamline your CI/CD pipelines for InfraWeave πŸš€

Resources

License

Stars

Watchers

Forks

Contributors