Skip to content

Enable securityContext for container specs #113

Enable securityContext for container specs

Enable securityContext for container specs #113

name: pytest-pr-check
on: # Define when this pytest will be run.
pull_request: # Run it on pull requests.
branches: [main]
env:
AWS_REGION : ${{ secrets.AWS_REGION }}
# Permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
# Define all jobs here.
jobs:
# This is our primary job: pytest.
Pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
# Here we are going to configure aws credentials.
# Use the github workflows action: aws-actions.
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
role-session-name: ${{ secrets.ROLE_SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
# Install dependancies for pytests.
- name: Install dependencies
# Upgrade pip, install pytest, and all requirements.
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run the pytest module.
- name: Test with pytest
# The environment in pytest gets passed some secrets from the github secrets.
env:
ROLE_TO_ASSUME: ${{ secrets.ROLE_TO_ASSUME }}
SAMPLE_ROLE_SESSION: ${{ secrets.ROLE_SESSION_NAME }}
PYTEST_FLAG: "True"
# Define some code here to also run during pytest.
run: |
pytest tests