Debian Codegraph @

ansible_collections/google/cloud/.github/workflows/ansible-integration-tests.yml

raw symbols SCIP
1 ---
2 name: Run integration tests for the cloud.google collection
3 on:
4 push:
5 branches:
6 - master
7 pull_request:
8 branches:
9 - master
10 env:
11 GCP_SERVICE_ACCOUNT: [email protected]
12 GCP_PROJECT: ansible-gcp-ci
13 GCP_PROJECT_NUMBER: "935806715932"
14 GCP_FOLDER_ID: "542027184392"
15 GCP_INTEGRATION_EMAIL: "[email protected]"
16 jobs:
17 setup:
18 if: |
19 github.event_name == 'push' ||
20 (github.event_name == 'pull_request' &&
21 github.event.pull_request.head.repo.full_name == github.repository)
22 runs-on: ubuntu-latest
23 env:
24 # only need to change this one stanza to use the same
25 # python version across all jobs in this workflow
26 PYTHON: "3.13"
27 outputs:
28 python: ${{ steps.set-python.outputs.version }}
29 steps:
30 - id: set-python
31 run: |
32 echo "version=$PYTHON" >> $GITHUB_OUTPUT
33
34 integration:
35 # NOTE: GitHub does not allow secrets to be used
36 # in PRs sent from forks. As such, this configuration is for
37 # PRs that the maintainers would like to send to test.
38 if: |
39 github.event_name == 'push' ||
40 (github.event_name == 'pull_request' &&
41 github.event.pull_request.head.repo.full_name == github.repository)
42 runs-on: ubuntu-latest
43 defaults:
44 run:
45 working-directory: ansible_collections/google/cloud
46 needs: setup
47 strategy:
48 max-parallel: 1
49 matrix:
50 # Our current version strategy is to support all active versions of ansible-core
51 # and test against the minimum version of Python supported by them. If/when we change
52 # the integration tests to support parallelism we can revisit.
53 ansible_version:
54 - stable-2.18
55 - stable-2.19
56 - stable-2.20
57 steps:
58 - name: check out code
59 uses: actions/checkout@v4
60 with:
61 path: ansible_collections/google/cloud
62 - name: Set up Python
63 uses: actions/setup-python@v4
64 with:
65 python-version: ${{ needs.setup.outputs.python }}
66 - name: Install dependencies
67 run: pip install -r requirements.txt
68 - name: Install ansible-base (${{ matrix.ansible_version }})
69 run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
70 # bootstrap integration env
71 - name: Write integration-test configuration files
72 env:
73 CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}
74 run: |
75 echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" > /tmp/service-account-key.json
76 echo "[default]
77 gcp_project: $GCP_PROJECT
78 gcp_project_number: $GCP_PROJECT_NUMBER
79 gcp_cred_file: /tmp/service-account-key.json
80 gcp_cred_kind: serviceaccount
81 gcp_cred_email: $GCP_SERVICE_ACCOUNT
82 gcp_integration_email: $GCP_INTEGRATION_EMAIL
83 gcp_folder_id: $GCP_FOLDER_ID
84 " > ./tests/integration/cloud-config-gcp.ini
85 # cleanup test environment
86 - name: Auth to Gcloud
87 uses: google-github-actions/auth@v1
88 env:
89 CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}
90 with:
91 service_account: $GCP_SERVICE_ACCOUNT
92 credentials_json: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}
93 - name: Set up Cloud SDK
94 uses: google-github-actions/setup-gcloud@v1
95 - name: Run cleanup
96 run: |
97 ./scripts/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT
98 ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_FOLDER_ID
99 - name: Install required collections
100 run: |
101 ansible-galaxy install -r requirements-test.yml
102 # run tests
103 - name: Run integration tests
104 # Add the -vvv flag to print out more output
105 run: ansible-test integration -vvv --color --python ${{ needs.setup.outputs.python }} --venv-system-site-packages