-
Notifications
You must be signed in to change notification settings - Fork 5
44 lines (44 loc) · 1.6 KB
/
pytest-pr-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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