Skip to content

Merge pull request #106 from thatguyfig/main #207

Merge pull request #106 from thatguyfig/main

Merge pull request #106 from thatguyfig/main #207

Workflow file for this run

# yamllint disable rule:line-length
---
name: lint-and-test
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
test:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# Retrieve temporary AWS credentials
#----------------------------------------------
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::166659698090:role/githubactions
role-session-name: ghasession
aws-region: us-east-1
#----------------------------------------------
# install dependencies
#----------------------------------------------
- name: Install python dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with test
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
#----------------------------------------------
# Run static linters
#----------------------------------------------
- name: Check black formatting
run: |
poetry run black --check -v modules
#----------------------------------------------
# add terravision to PATH
#----------------------------------------------
- name: Run tests after adding terravision to path
run: |
export PATH=$PATH:$(pwd)
rm -rf ~/.terravision
poetry run terravision --version
poetry run pytest tests -v