-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (76 loc) · 2.52 KB
/
_integration_tests.yml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
permissions:
actions: read
checks: read
contents: read
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: write
statuses: none
on:
workflow_call:
inputs:
data_lpa_api_url:
description: 'The url of the data lpa api gateway'
required: true
type: string
working_directory:
description: 'Working Directory to run tests from'
required: true
type: string
tests_directory:
description: 'Directory containing Pytest tests'
required: true
type: string
specific_tests:
description: 'File path to specific Pytest tests - currently used to run 1 test as a smoke test'
required: false
type: string
default: ""
secrets:
AWS_ACCESS_KEY_ID_ACTIONS:
description: 'AWS Access Key ID'
required: false
AWS_SECRET_ACCESS_KEY_ACTIONS:
description: 'AWS Secret Access Key'
required: false
jobs:
integration_tests:
name: Run integration tests
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Configure AWS Credentials For integration tests
uses: aws-actions/configure-aws-credentials@v4
if: ${{ env.AWS_ACCESS_KEY_ID != '' && env.AWS_SECRET_ACCESS_KEY != '' }}
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-duration-seconds: 900
role-session-name: GitHubActionsIntegrationTests
- name: Setup Python
uses: actions/setup-python@3fddbee7870211eda9047db10474808be43c71ec
with:
python-version: "3.12"
- name: Install integration test requirements.txt
run: |
python -m pip install --upgrade pip
pip install -r ${{ inputs.tests_directory }}/requirements.txt
- name: Run tests with Pytest
env:
DATA_LPA_API_URL: ${{ inputs.data_lpa_api_url }}
SPECIFIC_TESTS: ${{ inputs.specific_tests}}
working-directory: ${{ inputs.working_directory }}
run: |
coverage run -m pytest $SPECIFIC_TESTS -v -s
- name: Generate Coverage Report
working-directory: ${{ inputs.working_directory }}
run: |
coverage report -m