google.cloud/.github/workflows/ansible-integration-tests.yml
Yusuke Tsutsumi 4816e97719 fixing compute_url_map, add cleanup script
Compute_url_map was broken by #509: It also merged in #393, which
has an erroneous understanding that compute_url_map always returns
a diff (integration tests show it does not).

Adding a cleanup script to help with environment hygiene.

Added cleanup to CI to help make tests less flakey.
2022-11-12 12:12:02 -08:00

63 lines
No EOL
2.4 KiB
YAML

name: "Run integration tests for the cloud.google collection"
on:
# NOTE: GitHub does not allow secrets to be used
# in PRs sent from forks. As such, this configuration is for
# PRs that the maintainers would like to send to test.
pull_request: {}
push:
branches: master
env:
GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com"
GCP_PROJECT: "ansible-gcp-ci"
jobs:
integration:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ansible_collections/google/cloud
strategy:
matrix:
ansible_version:
# - stable-2.13
- stable-2.11
steps:
- name: check out code
uses: actions/checkout@v2
with:
path: ansible_collections/google/cloud
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.8' # this is the minimum version required for Ansible 2.11
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install ansible-base (${{ matrix.ansible_version }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
# bootstrap integration env
- name: Write integration-test configuration files
env:
CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}
run: |
echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" > /tmp/service-account-key.json
echo "[default]
gcp_project: $GCP_PROJECT
gcp_cred_file: /tmp/service-account-key.json
gcp_cred_kind: serviceaccount
gcp_cred_email: $GCP_SERVICE_ACCOUNT
" > ./tests/integration/cloud-config-gcp.ini
# cleanup test environment
- name: Auth to Gcloud
uses: google-github-actions/auth@v1
env:
CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}
with:
service_account: "$GCP_SERVICE_ACCOUNT"
credentials_json: "${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Run cleanup
run: ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT
# run tests
- name: Run integration tests
# Add the -vvv flag to print out more output
run: ansible-test integration -v --color --python 3.8 --venv-system-site-packages