Skip to content

Commit

Permalink
Update precommits
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorenciaSilvestre committed Feb 23, 2024
1 parent 175cb9b commit da74f92
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 77 deletions.
46 changes: 35 additions & 11 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
name: Pre-commit Check
name: Deploy Dev Infrastructure

on:
push:
branches:
- main
pull_request:
branches:
- main
- master

jobs:
pre-commit:
tf_fmt:
name: Deploy Dev App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Run image
uses: abatilo/actions-poetry@v2
- uses: pre-commit/action@v3.0.1

- name: Checkout Repo
uses: actions/checkout@v3

- name: Terraform Init
uses: hashicorp/terraform-github-actions/init@v0.4.0
with:
tf_actions_working_dir: 'terraform'
args: '-var-file="environments/dev.tfvars"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_ACTION_WORKING_DIR: 'terraform'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Terraform Validate
uses: hashicorp/terraform-github-actions/validate@v0.3.7
with:
tf_actions_working_dir: 'terraform'
args: '-var-file="environments/dev.tfvars"'

- name: Terraform Apply
uses: hashicorp/terraform-github-actions/apply@v0.4.0
with:
tf_actions_working_dir: 'terraform'
args: '-var-file="environments/dev.tfvars"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_ACTION_WORKING_DIR: 'terraform'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29 changes: 13 additions & 16 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Deploy Dev Infrastructure
name: Deploy Prod Infrastructure

on:
push:
branches:
- master

workflow_dispatch:
jobs:
tf_fmt:
name: Deploy Site
name: Deploy Prod App
runs-on: ubuntu-latest
steps:

- name: Checkout Repo
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Terraform Init
uses: hashicorp/terraform-github-actions/init@v0.4.0
with:
tf_actions_working_dir: 'terraform'
args: '-var-file="environments/prod.tfvars"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_ACTION_WORKING_DIR: 'terraform'
Expand All @@ -24,20 +24,17 @@ jobs:

- name: Terraform Validate
uses: hashicorp/terraform-github-actions/validate@v0.3.7
with:
tf_actions_working_dir: 'terraform'
args: '-var-file="environments/prod.tfvars"'

- name: Terraform Apply
uses: hashicorp/terraform-github-actions/apply@v0.4.0
with:
tf_actions_working_dir: 'terraform'
args: '-var-file="environments/prod.tfvars"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_ACTION_WORKING_DIR: 'terraform'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Sync S3
uses: jakejarvis/s3-sync-action@master
env:
SOURCE_DIR: './src'
AWS_REGION: 'us-east-1'
AWS_S3_BUCKET: '[BUCKET_NAME_HERE]'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19 changes: 19 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Pre-commit Check

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Run image
uses: abatilo/actions-poetry@v2
- uses: pre-commit/action@v3.0.1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.terraform/
11 changes: 5 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ repos:
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-all]
exclude: ^testing/resources/
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.53.0
hooks:
- id: terraform_fmt
- id: terraform_docs
50 changes: 6 additions & 44 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: double-quote-string-fixer
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
exclude: ^(pre_commit/resources/|testing/resources/python3_hooks_repo/)
args: [--py39-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/hhatto/autopep8
rev: v2.0.4
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-all]
exclude: ^testing/resources/
- id: validate_manifest
name: validate pre-commit manifest
description: This validator validates a pre-commit hooks manifest file
entry: pre-commit validate-manifest
language: python
files: ^\.pre-commit-hooks\.yaml$

0 comments on commit da74f92

Please sign in to comment.