name: "Run integration tests for the cloud.google collection" on: pull_request: {} push: branches: master env: GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com" GCP_PROJECT: "ansible-gcp-ci" jobs: integration: # 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. if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest defaults: run: working-directory: ansible_collections/google/cloud strategy: matrix: ansible_version: - stable-2.13 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.13 - 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/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT ./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