Configure Renovate #93
Workflow file for this run
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: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: # enable manual execution | |
env: | |
COOKIECUTTER_PARAM_REPO_NAME: "infra" | |
COOKIECUTTER_PARAM_ENVIRONMENT: "prod" | |
TERRAFORM_DIR: "infra/terraform" | |
TERRAFORM_PROD_DIR: "infra/terraform/prod" | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cookiecutter: | |
name: Cookiecutter | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Setup Cookiecutter | |
run: pip install cookiecutter==2.5.0 | |
- name: Generate project | |
run: | | |
cookiecutter . --no-input --verbose \ | |
repo_name="${COOKIECUTTER_PARAM_REPO_NAME}" \ | |
environment="${COOKIECUTTER_PARAM_ENVIRONMENT}" | |
- name: ShellCheck generated scripts | |
uses: ludeeus/[email protected] | |
env: | |
SHELLCHECK_OPTS: --severity style --enable all --exclude SC2312 --shell bash | |
with: | |
check_together: yes | |
scandir: "infra/scripts" | |
- name: Setup act | |
uses: actionsflow/setup-act@v1 | |
- name: Test generated GitHub workflow | |
run: | | |
cd "${COOKIECUTTER_PARAM_REPO_NAME}" | |
act --dryrun --platform "ubuntu-latest=catthehacker/ubuntu:act-latest" | |
- name: Get Terraform version | |
run: | | |
TERRAFORM_VERSION=$(jq --raw-output '.terraform_version' cookiecutter.json) | |
echo "TERRAFORM_VERSION=${TERRAFORM_VERSION}" >> "${GITHUB_ENV}" | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: ${{ env.TERRAFORM_VERSION }} | |
- name: Format check generated Terraform | |
run: terraform fmt -check -recursive "${TERRAFORM_DIR}/" | |
- name: Init generated Terraform | |
run: terraform -chdir="${TERRAFORM_PROD_DIR}" init -backend=false | |
- name: Validate generated Terraform | |
run: terraform -chdir="${TERRAFORM_PROD_DIR}" validate | |
- name: Upload generated project | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.COOKIECUTTER_PARAM_REPO_NAME }} | |
path: | | |
${{ env.COOKIECUTTER_PARAM_REPO_NAME }}/ | |
!${{ env.TERRAFORM_PROD_DIR }}/.terraform | |
if-no-files-found: error |