-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathpython-psycopg2-integ-tests.yml
More file actions
79 lines (69 loc) · 2.4 KB
/
python-psycopg2-integ-tests.yml
File metadata and controls
79 lines (69 loc) · 2.4 KB
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
name: Python Psycopg2 integration tests
permissions: {}
on:
workflow_call: {}
workflow_dispatch:
push:
branches: [ main ]
jobs:
create-cluster:
uses: ./.github/workflows/dsql-cluster-create.yml
with:
workflow_name: python-psycopg2
secrets:
AWS_IAM_ROLE: ${{ secrets.PYTHON_IAM_ROLE }}
permissions:
id-token: write # required by aws-actions/configure-aws-credentials
python-psycopg2-integ-test:
needs: create-cluster
runs-on: ubuntu-latest
permissions:
id-token: write # required by aws-actions/configure-aws-credentials
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Cache pip packages
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.PYTHON_IAM_ROLE }}
aws-region: ${{ needs.create-cluster.outputs.region }}
- name: Configure and run integration for psycopg2 - admin
working-directory: ./python/psycopg2
env:
CLUSTER_USER: "admin"
CLUSTER_ENDPOINT: ${{ needs.create-cluster.outputs.cluster-endpoint }}
REGION: ${{ needs.create-cluster.outputs.region }}
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install --force-reinstall -r requirements.txt
python3 -c "import boto3; print(boto3.__version__)"
pip list
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
wget https://www.amazontrust.com/repository/AmazonRootCA1.pem -O root.pem
pytest
delete-cluster:
if: always() && needs.create-cluster.result == 'success'
needs: [create-cluster, python-psycopg2-integ-test]
uses: ./.github/workflows/dsql-cluster-delete.yml
with:
cluster-id: ${{ needs.create-cluster.outputs.cluster-id }}
region: ${{ needs.create-cluster.outputs.region }}
secrets:
AWS_IAM_ROLE: ${{ secrets.PYTHON_IAM_ROLE }}
permissions:
id-token: write # required by aws-actions/configure-aws-credentials