-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (59 loc) · 2.07 KB
/
pseudo-service-integration-test.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Pseudo service integration test
env:
PSEUDO_SERVICE_URL: "https://dapla-pseudo-service.staging-bip-app.ssb.no"
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: "read"
id-token: "write"
jobs:
integration_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { python: "3.10"}
- { python: "3.11"}
- { python: "3.12"}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- id: "auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/[email protected]"
with:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.INTEGRATION_TEST_SA_EMAIL }}
token_format: "access_token"
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Generate, mask, and output Google ID token as a secret
id: get-id-token
env:
PRIVILEGED_SERVICE_ACCOUNT: ${{ secrets.INTEGRATION_TEST_PRIV_SA_EMAIL }}
run: |
# REQUIRED TO KEEP GH ACTIONS FOR LOGGING THE ID TOKEN
# SEE: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-masking-a-generated-output-within-a-single-job
pseudo_service_auth_token="$(gcloud auth print-identity-token --impersonate-service-account=$PRIVILEGED_SERVICE_ACCOUNT --audiences=$PSEUDO_SERVICE_URL --include-email)"
echo "::add-mask::$pseudo_service_auth_token"
echo "PSEUDO_SERVICE_AUTH_TOKEN=$pseudo_service_auth_token" >> "$GITHUB_OUTPUT"
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name : Install requirements
run: |
pip install .
pip install pytest
pip install pytest_cases
- name: Integration test
env:
PSEUDO_SERVICE_AUTH_TOKEN: ${{ steps.get-id-token.outputs.PSEUDO_SERVICE_AUTH_TOKEN }}
run: pytest tests/v1/integration